File: plotorder.pl

package info (click to toggle)
parmetis 4.0.3-5
  • links: PTS, VCS
  • area: non-free
  • in suites: bullseye, buster, sid
  • size: 25,384 kB
  • ctags: 3,256
  • sloc: ansic: 41,872; makefile: 298; sh: 190; perl: 25
file content (35 lines) | stat: -rw-r--r-- 809 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/perl

die "Usage: plotorder.pl <graphfile> <orderfile> <sizesfile>\n" unless ($#ARGV == 2);

$graphfile = shift(@ARGV);
$orderfile = shift(@ARGV);
$sizesfile = shift(@ARGV);


#=========================================================================
# Read the graph file
#=========================================================================
open(FPIN, "<$graphfile");
$_ = <FPIN>;
chomp($_);
($nvtxs, $nedges, $flags) = split(' ', $_);
$readvw = $flags&2;
$readew = $flags&1;

$nnz = 0;
$xadj[0] = 0;
for ($i=0; $i<$nvtxs; $i++) {
  $_ = <FPIN>;
  chomp($_);
  @fields = split(' ', $_);
  $vwgt[$i] = shift(@fields) if ($readvw);
  while (@fields) {
    $adjncy[$nnz] = shift(@fields)-1;
    $adjwgt[$nnz] = shift(@fields) if ($readew);
    $nnz++;
  }
  $xadj[$i+1] = $nnz;
}
close(FPIN);