private static AdjMatrixDigraph GetAdjMatrixDigraph(int v, Tuple <int, int>[] edges) { AdjMatrixDigraph g = new AdjMatrixDigraph(v); foreach (var edge in edges) { g.AddEdge(edge.Item1, edge.Item2); } Console.WriteLine("Adjacency Matrix Direct Graph: "); Console.WriteLine(g.ToString()); return(g); }
public AdjMatrixDigraph Transpose1() { AdjMatrixDigraph g = new AdjMatrixDigraph(V); for (int i = 0; i < V; i++) { for (int j = 0; j < V; j++) { if (_matrix[i, j] == 1) { g.AddEdge(j, i); } } } return(g); }
public AdjMatrixDigraph Square1() { AdjMatrixDigraph g = new AdjMatrixDigraph(V); for (int i = 0; i < V; i++) { for (int j = 0; j < V; j++) { if (_matrix[i, j] == 1) { g.AddEdge(i, j); for (int k = 0; k < V; k++) { if (_matrix[j, k] == 1) { g.AddEdge(i, k); } } } } } return(g); }