Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

you can just copy-paste if you want

sage: data = ["v1","v2","v3","v4","v5","v6","v7","v8"], [["v1","v1","a"],["v1","
....: v2","b"],["v2","v3","c"],["v3","v4","d"],["v4","v5","e"],["v5","v5","f"],
....: ["v3","v6","g"],["v6","v7","h"],["v7","v8","i"],["v8","v3","j"]]          
sage: DiGraph(data, format="vertices_and_edges",loops=True)                     
Looped digraph on 8 vertices

you can just copy-paste if you want

sage: data = ["v1","v2","v3","v4","v5","v6","v7","v8"], [["v1","v1","a"],["v1","
....: v2","b"],["v2","v3","c"],["v3","v4","d"],["v4","v5","e"],["v5","v5","f"],
....: ["v3","v6","g"],["v6","v7","h"],["v7","v8","i"],["v8","v3","j"]]          
sage: DiGraph(data, format="vertices_and_edges",loops=True)                     
Looped digraph on 8 vertices

EDIT: here is a more procedural way

def from_QPA(Q): 
    arrows = [(v.SourceOfPath(), v.TargetOfPath(), v) for v in Q.ArrowsOfQuiver() ] 
    elements = Q.VerticesOfQuiver() 
    return DiGraph([elements, arrows], loops=True, format='vertices_and_edges')

then

sage: libgap.LoadPackage("QPA")                                                 
true
sage: Q = libgap.Quiver( ["v1","v2","v3"], [["v1","v2","a1"],["v2","v3","a2"],["v3","v1","a3"]] )
sage: from_QPA(Q)                                                               
Looped digraph on 3 vertices