7
$\begingroup$

Bug introduced in 10.0 and fixed in 10.3


Good afternoon,

I have observed an "unexpected behaviour" with VertexDelete and a graph with vertex weights. This is a minimal working example:

OK

gr = Graph[{1 \[DirectedEdge] 2, 1 \[DirectedEdge] 3, 2 \[DirectedEdge] 4, 
            4 \[DirectedEdge] 5}]
FullForm@gr
new = VertexDelete[gr, 5]
FullForm@new

VertexDelete works as expected. The FullForm of new is:

Graph[List[1, 2, 3, 4], List[DirectedEdge[1, 2], DirectedEdge[1, 3], DirectedEdge[2, 4]]]

If I assign a vertex weight to vertex 4, I get an error message:

NOT OK

gr = Graph[{1 \[DirectedEdge] 2, 1 \[DirectedEdge] 3, 2 \[DirectedEdge] 4, 
            4 \[DirectedEdge] 5}];
gr = SetProperty[{gr, 4}, VertexWeight -> 666]
FullForm@gr
new = VertexDelete[gr, 5]
FullForm@new

Drop::drop: "Cannot drop positions 5 through 5 in {1,1,1,666}."

FullForm of new contains $$Failure:

Graph[List[1, 2, 3, 4], List[DirectedEdge[1, 2], DirectedEdge[1, 3], DirectedEdge[2, 4]], 
      List[Rule[VertexWeight, Removed["$$Failure"] ] ] ]

I am using Mathematica version 10.1.0 for Microsoft Windows (64-bit) (March 24, 2015).

I can successfully delete a vertex prior to index 4 (the one where I have assigned a weight to). I saw some other posts regarding issues with VertexDelete. My real graph contains 60k vertices and more than 100k edges.

Can someone confirm this on other OS and version?

$\endgroup$
4
  • $\begingroup$ I can confirm the problem on OS X 10.10.3, Mma 10.1.0. There was a similar problem with EdgeWeight in 10.0, which got fixed. $\endgroup$
    – Szabolcs
    Commented May 28, 2015 at 10:54
  • $\begingroup$ Please report this to Wolfram. $\endgroup$
    – Szabolcs
    Commented May 28, 2015 at 10:54
  • $\begingroup$ I have reported it a few minutes ago. $\endgroup$
    – 32u-nd
    Commented May 28, 2015 at 10:59
  • $\begingroup$ I've experienced similar issues deleting/adding vertices to Graph with properties back in v9. Note that PropertyValue does not fix this issue either. Fundamentally there is not a GraphData object living within Graph, allowing you to create objects that cannot be used consistently with the Graph functions. If possible I always give my properties first, Graph[{Property[1,VertexLabels->"foo"],2,3},{Property[1->2,EdgeWeight->4],2->3,3->1}] but even that won't save you here :( $\endgroup$ Commented May 28, 2015 at 12:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.