Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

The VertexRenderingFunction seems to only use names, not labels. For example:

GraphPlot[Import["D:/dev/ProjectEuler/keylog.gv"],VertexLabeling->True,PlotStyle->{Black},VertexRenderingFunction->({EdgeForm[Black],White,Disk[#1,0.08],Black,Text[#2,#1]}&)]

The imported gv file here has both names and labels defined for each node. The names are always unique, but the labels are not necessarily unique.

Unfortunately, the above GraphPlot only shows the NAMES of the vertices, not the labels. How can I get the labels and not the names?

enter image description here

The vertex annotations above are names, not labels of each vertex. The DOT file is as follows:

digraph Passcode {
    0 [label="3"];
    1 [label="1"];
    2 [label="9"];
    3 [label="6"];
    4 [label="8"];
    5 [label="0"];
    6 [label="2"];
    7 [label="7"];
    0 -> 1;
    0 -> 2;
    0 -> 3;
    0 -> 4;
    1 -> 4;
    1 -> 6;
    1 -> 5;
    1 -> 3;
    1 -> 2;
    2 -> 5;
    3 -> 4;
    3 -> 2;
    3 -> 6;
    3 -> 5;
    4 -> 5;
    4 -> 2;
    6 -> 2;
    6 -> 5;
    6 -> 4;
    7 -> 3;
    7 -> 1;
    7 -> 6;
    7 -> 0;
    7 -> 2;
}
share|improve this question
    
If you can provide actual data files, it will be much helpful to diagnose.. –  halmir Dec 9 '13 at 16:41
    
@halmir I pasted the contents into the post. –  Tyler Durden Dec 9 '13 at 16:51

1 Answer 1

You could import it first and modify options:

g = Import["D:/dev/ProjectEuler/keylog.gv"];

SetProperty[g, {EdgeStyle -> Black, VertexShapeFunction -> ({EdgeForm[Black], White, Disk[#1, 0.08]} &),
 VertexLabels -> (#1 -> Placed[#2, Center]) & @@@ (VertexLabels /. 
 Options[g, VertexLabels]), GraphLayout -> "SpringEmbedding"}]

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.