Shared(Co)ProdPublic.sagewsOpen in CoCalc
Author: Tien Chih
Views : 2
import sys from sage.all import * #Graphs G and H G = Graph([('a', 'b'),('b', 'c'), ('d','a'), ('b', 'd')]) H = Graph([(1, 2), (2, 3) ]) #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #PLEASE DO NOT EDIT ANYTHING AFTER THIS LINE! #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! print("\n\n Graph G \n") G.show() print("\n\n Graph H \n\n") H.show() #Prints the Product and Coproduct print("Grphs product of G and H") Prod = G.strong_product(H); Prod.show() print("Grphs co-product of G and H") Coprod = G.disjoint_union(H); Coprod.show()