View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013315VTK(No Category)public2012-07-19 09:552016-08-12 09:55
Reporterawehrer 
Assigned ToDave DeMarle 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusclosedResolutionmoved 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0013315: vtk 5.10.0: vtkXGMLReader does not load custom attribute values properly into vtkMutableUndirectedGraph
DescriptionSteven had pointed out how the labels on the tiny graph example were all off by one. Each vertex is defined to have a "label" attribute based on our GML file, which we set to be the graphical labels. The node labels start with "node1," and the internal vertex id's start at 0. When you look at the graph when displayed on the screen, the first label that appears in order is "node2." However, when I set the labels to be the vertex id's, "node2" becomes "0." With further investigation into the VertexData for the vtkUndirectedGraph, the first element that appears in the label attribute array is "node2." This means "node1" was never stored. Looking at the source code for vtkXGMLReader beforehand, there was a section where I went, "Huh?" I thought maybe I was reading their syntax wrong, but it turns out that might be an error after all.

The indices of the attribute data correspond to the internal vertex id's from 0 to n - 1, not the input id's from 1 to n used in the files. When reading input id's, it maps them to the internal id's in a temporary collection:

id = builder->AddVertex();
nodeIdMap[tok.IntValue] = id;

However, maintaining the same value for the variable id, when it goes to load a single value into the label attribute array, it uses:

vtkStringArray::SafeDownCast(property_table[i].Data)->SetValue(nodeIdMap[id], tok.StringValue);

So, for node 1, id = 0, nodeIdMap[1] = 0, and nodeIdMap[id] = nodeIdMap[0] = ?? <-- index of "node1"
So, for node 2, id = 1, nodeIdMap[2] = 1, and nodeIdMap[id] = nodeIdMap[1] = 0 <-- index of "node2"
So, for node 3, id = 2, nodeIdMap[3] = 2, and nodeIdMap[id] = nodeIdMap[2] = 1 <-- index of "node3"

Anyone see a pattern?

Looking at how they used the edgeIdMap, it seems they had intended for it to work analogously to nodeIdMap, but in order for that to happen, I had to correct two lines of code. I have attached the corrected file, where the two changed lines are marked with the comment "FIX." If you need a demonstration, I do have a python script and our small GML file.
TagsNo tags attached.
ProjectTBD
Typeincorrect functionality
Attached Filescxx file icon vtkXGMLReader.cxx [^] (13,996 bytes) 2012-07-19 09:55
? file icon tiny-graph.py [^] (1,212 bytes) 2012-07-19 09:57
? file icon tiny-with-labels.gml [^] (4,880 bytes) 2012-07-19 09:57

 Relationships

  Notes
(0031068)
Dave DeMarle (administrator)
2013-06-25 14:47

Thanks. Would you mind submitting that fix in gerrit to facilitate automated testing and review?
For details on how to do so see http://www.vtk.org/Wiki/VTK/Git/Develop [^]
(0031160)
Dave DeMarle (administrator)
2013-07-22 14:40

If this bug is still present in 6.0.0, please reopen this report.
(0037289)
Kitware Robot (administrator)
2016-08-12 09:55

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current VTK Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2012-07-19 09:55 awehrer New Issue
2012-07-19 09:55 awehrer File Added: vtkXGMLReader.cxx
2012-07-19 09:57 awehrer File Added: tiny-graph.py
2012-07-19 09:57 awehrer File Added: tiny-with-labels.gml
2013-06-25 14:47 Dave DeMarle Note Added: 0031068
2013-07-22 14:40 Dave DeMarle Note Added: 0031160
2013-07-22 14:40 Dave DeMarle Status backlog => expired
2013-07-22 14:40 Dave DeMarle Resolution open => fixed
2013-07-22 14:40 Dave DeMarle Assigned To => Dave DeMarle
2016-08-12 09:55 Kitware Robot Note Added: 0037289
2016-08-12 09:55 Kitware Robot Status expired => closed
2016-08-12 09:55 Kitware Robot Resolution fixed => moved


Copyright © 2000 - 2018 MantisBT Team