Output Generation with GraphViz

194 Views Asked by At

I am supposed to write output into a text file with C++ and then process it using GraphViz.

This extract from my code:

  cout << "  " << i << " -> " << j 

shows this error when I run it:

 Error: MyGraph5V20E:4: syntax error near line 4
 context:   0 >>>  - <<< > 1 [label="73"];

And this is the output file:

 graph G {
     node [shape=circle]
     0 -> 1 [label="73"];
     0 -> 2 [label="60"];
     0 -> 3 [label="36",color=red];
     0 -> 4 [label="71"];
     1 -> 2 [label="50",color=red];
     1 -> 3 [label="78"];
     1 -> 4 [label="85"];
     2 -> 3 [label="30",color=red];
     2 -> 4 [label="23",color=red];
     3 -> 4 [label="68"];
  }

I suppose it has to do with " -> " in my code. How can I manouvre this??

0

There are 0 best solutions below