OK here is my current scenario -
I have an input data file (test.txt) with pairs of nodes (tab-delimited) -
I have a script to read this file and produce for each pair of nodes a statement to add the pair as an edge to a graph (thanks KevinADC!):
what is driving me crazy is that for each of the pairs, instead of producing -
I am getting -
What I can't figure out is why the statement appears over two lines and breaks after the second node - if anyone has a clue how to fix that, I would be really grateful
I have an input data file (test.txt) with pairs of nodes (tab-delimited) -
Code:
G:1 G:2
G:4 G:5
G:7 G:4
G:9 G:10
G:12 G:7
I have a script to read this file and produce for each pair of nodes a statement to add the pair as an edge to a graph (thanks KevinADC!):
Code:
open (EDGELIST, "test.txt") || die ("Could not open file!");
@edgelistarray=<EDGELIST>;
foreach my $edge (@edgelistarray)
{
my($from,$to) = split (/\t/, $edge);
print "\$GRAPH->add_edge(\"${from}\",\"${to}\");\n";
}
what is driving me crazy is that for each of the pairs, instead of producing -
Code:
$GRAPH->add_edge("G:1","G:2");
I am getting -
Code:
$GRAPH->add_edge("G:1","G:2
");
What I can't figure out is why the statement appears over two lines and breaks after the second node - if anyone has a clue how to fix that, I would be really grateful