Skip to content

Commit 5531dee

Browse files
authored
Add lowercase support to loadnet function. (#63)
Added lowercase support to function `loadnet`, making it possible to parse graphs from `.net` files generated by NetworkX in Python.
1 parent 3211943 commit 5531dee

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/NET/Net.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,22 @@ function loadnet(io::IO, gname::String="graph")
4444
n = parse(Int, match(r"\d+", line).match)
4545
for ioline in eachline(io)
4646
line = ioline
47-
(occursin(r"^\*Arcs", line) || occursin(r"^\*Edges", line)) && break
47+
(occursin(r"^\*[Aa]rcs", line) || occursin(r"^\*[Ee]dges", line)) && break
4848
end
49-
if occursin(r"^\*Arcs", line)
49+
if occursin(r"^\*[Aa]rcs", line)
5050
g = Graphs.DiGraph(n)
5151
else
5252
g = Graphs.Graph(n)
5353
end
54-
while occursin(r"^\*Arcs", line)
54+
while occursin(r"^\*[Aa]rcs", line)
5555
for ioline in eachline(io)
5656
line = ioline
5757
ms = collect(m.match for m in eachmatch(r"\d+", line; overlap=false))
5858
length(ms) < 2 && break
5959
add_edge!(g, parse(Int, ms[1]), parse(Int, ms[2]))
6060
end
6161
end
62-
while occursin(r"^\*Edges", line) # add edges in both directions
62+
while occursin(r"^\*[Ee]dges", line) # add edges in both directions
6363
for ioline in eachline(io)
6464
line = ioline
6565
ms = collect(m.match for m in eachmatch(r"\d+", line; overlap=false))

0 commit comments

Comments
 (0)