News for hackers. Stuff that matters.
Re:Show HN: Indented outline to graphviz by pvaldes on Monday July 06, 2015 @04:22PM (#9841939)
Interesting but also prone to errors. Subtopic one (in topic one) will be different as Subtopic one (in topic two) in most real cases, probably. A clear example is scientific literature where each chapter could have a 'results' section, maybe with different subsection names.

The reverse situation can be also a problem. 'Subtopic one', 'subtopic one' and 'subtopic One' for example, are taken as three different nodes. This can either be good or bad.

Other problem is that your code generates a bad graph when you have a " in the infile. Try it with: Topic "Two"

Re:Show HN: Indented outline to graphviz by chestervonwinch on Monday July 06, 2015 @07:41PM (#9842812)
> Subtopic one (in topic one) will be different as Subtopic one (in topic two) in most real cases, probably. A clear example is scientific literature where each chapter could have a 'results' section, maybe with different subsection names.

I agree. In fact, I set out to make it this way initially. It's either more difficult to implement this, or I don't know the dot language well enough - probably the latter.

I did a dirty hack to do exactly what you're saying for a scientific paper. I modified the code to check if the current line/topic/node was already mentioned in the output string. If so, I tacked on a random number to the node name. Yuck.

Ideally, there would be option to preserve a strict tree-like architecture in better way.

Re:Show HN: Indented outline to graphviz by pvaldes on Tuesday July 07, 2015 @03:56AM (#9844125)
> It's either more difficult to implement this

Something like this should be enough

    "topiconesubtopictwo" [label = "subtopic two"];
    "topictwosubtopictwo" [label = "subtopic two"];
Or alternatively you can use a counter.

    12 [label = 'subtopic two'];
    22 [label = 'subtopic two'];
If you avoid spaces you can also forget the quotes (but quotes are safer)

     topiconesubtopictwo [label = "subtopic two"];
But avoid to name nodes with '_' and '.'

     topic_one_subtopic_two [label, etc...]
     topic.one.subtopic.two [label, etc...]
Re:Show HN: Indented outline to graphviz by chestervonwinch on Tuesday July 07, 2015 @10:15AM (#9845543)
I think the counter is great idea. Thanks.