Skip to content

Commit 9f74097

Browse files
authored
Merge pull request #7 from JuliaGraphs/start_id_error
fix symbol naming bug missed in tests
2 parents 00de09c + 6727bfd commit 9f74097

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

src/GraphDataFrameBridge.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function metagraph_from_dataframe(graph_type,
119119
edge_attributes = Vector{Symbol}([edge_attributes])
120120
end
121121

122-
origin_id = Symbol(start, :_id)
122+
origin_id = Symbol(origin, :_id)
123123
destination_id = Symbol(destination, :_id)
124124

125125
for e in edge_attributes

test/graphdataframebridge.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,21 @@ importall GraphDataFrameBridge
3636
@test get_prop(mg, Edge(1, 2), :weight) == 1
3737
@test get_prop(mg, Edge(4, 5), :weight) == 4
3838
@test get_prop(mg, Edge(4, 5), :extras) == 8
39+
40+
41+
# Test with different column names to ensure nothing name sensitive
42+
df2 = DataFrame(Dict("alice" => ["a", "b", "a", "d"],
43+
"bob" => ["b", "c", "e", "e"],
44+
"weightz" => 1:4,
45+
"extraz" => 5:8))
46+
47+
mg = MetaGraph(df2, :alice, :bob,
48+
weight=:weightz,
49+
edge_attributes=:extraz)
50+
@test length(neighbors(mg, 2)) == 2
51+
@test get_prop(mg, Edge(1, 2), :weight) == 1
52+
@test get_prop(mg, Edge(4, 5), :weight) == 4
53+
@test get_prop(mg, Edge(4, 5), :extraz) == 8
54+
55+
3956
end

0 commit comments

Comments
 (0)