CoCalc Public Files(Co)ProdPublic.sagewsOpen in with one click!
Author: Tien Chih
Views : 13
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") print("\n\n Graph H \n\n") #Prints the Product and Coproduct print("Grphs product of G and H") Prod = G.strong_product(H); print("Grphs co-product of G and H") Coprod = G.disjoint_union(H);