This method will take in any two graphs and output the strong proudct of the two graphs. The vertex set of the strong product of G and H is the cartesian product of the vertex sets of G and H. The keys for each vertex will be output as a sequence to represent this clearly. The edge set of the strong product of G and H is formed by the rule any two distinct vertices (u,u') and (v,v') are adjacent in G and H if and only if u' is adjacent with v' or u'=v' , and u is adjacent with v or u = v.
i1 : G = graph({1,2},{{1,2}}); |
i2 : H = graph({3,4,5},{{3,4},{4,5}}); |
i3 : strongProduct(G,H) o3 = Graph{{1, 3} => {{2, 3}, {1, 4}, {2, 4}} } {1, 4} => {{2, 5}, {1, 3}, {2, 3}, {2, 4}, {1, 5}} {1, 5} => {{2, 5}, {1, 4}, {2, 4}} {2, 3} => {{1, 3}, {1, 4}, {2, 4}} {2, 4} => {{2, 5}, {1, 3}, {2, 3}, {1, 4}, {1, 5}} {2, 5} => {{1, 4}, {2, 4}, {1, 5}} o3 : Graph |
The object strongProduct is a method function.