OldGraphs.jl icon indicating copy to clipboard operation
OldGraphs.jl copied to clipboard

trouble creating plots with attributes

Open tungli opened this issue 7 years ago • 1 comments

I was trying to create a more advanced graph plot by using ExEdge and ExVertex objects in a graph but passing them to to_dot() function resulted in skipping the attributes. I fixed it by bypassing an if-block in dot.jl, line 27:

if false#implements_edge_list(graph) && implements_vertex_map(graph)

This is, of course, not an ideal solution, hopefully somebody who has a better understanding of the package structure can fix this properly.

tungli avatar May 26 '18 11:05 tungli

Also, this seems to be an edge-only problem. An example would be:

using Graphs
attr_vert = Dict{String,Any}("color"=>"red")   #aiming for red nodes
attr_edges = Dict{String,Any}("label"=>"edge")   #... and labels on edges
vs = [ ExVertex(i,"$i") for i in 1:3 ]  #3 vertices
for i in vs; i.attributes = attr_vert; end   #adding attributes to vertices
eds = [ExEdge(1,vs[1],vs[2],attr_edges)]  #array of 1 edge
g = graph(vs,eds) 
plot(g)  #Graphs.plot()

tungli avatar May 26 '18 12:05 tungli