gephi/gephi

dot attribute parser defects

SaculRennorb opened this issue · 0 comments

Expected Behavior

dot files get loaded properly

Current Behavior

they do not

Steps to Reproduce

save this as text.dot or similar and open it in gephi:

digraph test {
    Skill_38d2a09ab424df40b347da44c3b7c192 [label="a"] [color="green"];
    Skill_7bf98ed70a7d964b9b3771e26bc44124 [label="b"] [color="green"];
    Skill_38d2a09ab424df40b347da44c3b7c192 -> Skill_7bf98ed70a7d964b9b3771e26bc44124 [label=""] [color="azure"];
}

Your Environment

  • Version used: Gephi 0.10.1
  • Operating System: Win10x64

It seems like the importer only looks for the label attribute.

This:

digraph test {
    n1 [label="a"];
    n2 [label="b"];
}

gets loaded properly, however this

digraph test {
    n1 [label="l1"] [color="green"];
    n2 [label="l2"] [color="green"];
}

only processes the label attribute and ignores color.
Setting only the color attribute also gets ignored.
edit: I was confused about the color attribute, as it doesn't show up as a separate attribute in the data lab. It does however seem to get picked up, even if it only seems to work for specific colors.

It seems like using [atr1=".." attr2=".."] works.

It also looks like the importer completely falls apart once you introduce multiple attributes, as seen by the test data resulting in
image

From having a quick look at the importer it seems like you assume there is only ever one attribute per node, which is not correct.

if (streamTokenizer.ttype == '-' || (streamTokenizer.ttype == StreamTokenizer.TT_WORD &&
(streamTokenizer.sval.equalsIgnoreCase("-") || streamTokenizer.sval.equalsIgnoreCase("--")))) {
NodeDraft nodeDraft = getOrCreateNode(nodeId);
edgeStructure(streamTokenizer, nodeDraft);
} else if (streamTokenizer.ttype == '[') {
NodeDraft nodeDraft = getOrCreateNode(nodeId);
nodeAttributes(streamTokenizer, nodeDraft);
} else {
getOrCreateNode(nodeId);
streamTokenizer.pushBack();
}
}

Should maybe loop until ; or EOL, but looping the whole section is likely going to mess up edge parsing, so this is just a rough suggestion. also I don't really know the code, I just had a quick gander.

I wasn't sure where exactly to put this, so ill just link possibly related issues here: #320 #1644 #2780