Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Paste
P742
(An Untitled Masterwork)
Active
Public
Actions
Authored by
seirl
on Aug 13 2020, 12:34 AM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Subscribers
None
public
class
ReadLabelledGraph
{
public
static
void
main
(
String
[]
args
)
throws
IOException
,
ClassNotFoundException
{
String
graphPath
=
args
[
0
];
ArcLabelledImmutableGraph
graph
=
BitStreamArcLabelledImmutableGraph
.
loadOffline
(
graphPath
+
"-labelled"
);
ArcLabelledNodeIterator
it
=
graph
.
nodeIterator
();
while
(
it
.
hasNext
())
{
long
srcNode
=
it
.
nextLong
();
ArcLabelledNodeIterator
.
LabelledArcIterator
s
=
it
.
successors
();
long
dstNode
;
while
((
dstNode
=
s
.
nextLong
())
>=
0
)
{
int
label
=
(
int
)
s
.
label
().
get
();
int
missing
=
(
1
<<
s
.
label
().
fixedWidth
())
-
1
;
if
(
label
==
missing
)
label
=
-
1
;
System
.
out
.
format
(
"%d %d %d\n"
,
srcNode
,
dstNode
,
label
)
);
}
}
}
}
Event Timeline
seirl
created this paste.
Aug 13 2020, 12:34 AM
2020-08-13 00:34:25 (UTC+2)
Log In to Comment