Now I am having trouble defining custom properties. my code is
g = CompleteGraph[4]
g2 = SetProperty[g, "name" -> "shambalulu"]
BreadthFirstScan[g2, {
"DiscoverVertex" -> Function[{child, parent, deg}, {
Print[PropertyValue[{g2, child}, "name"]],
Print[PropertyList[{g2, child}]]
}]
}
]
which works for VertexStyle->Red, but not for this case.
running this code returns $Failed for each vertex's PropertyValue, and {VertexCoordinates,VertexShape,VertexShapeFunction,VertexSize,VertexStyle} for the PropertyList.
So it seems like the SetProperty function failed silently for some reason, but here at 'user properties' and here at the basic examples it seems possible.
I also tried this code:
Property[g2, "name"-> "shambalulu"]
but it didn't even work with vertexStyle, simply returning the Property relation as typed.
Again, the goal is to create a custom property with a default value for all vertices, so specifying every vertex like in:
Graph[{Property[1, "name" -> "shambalulu"], 2, 3}, {1 <-> 2, 2 <-> 3, 3 <-> 1}]
is not good enough...
Any ideas?