Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

remove add/remove vertex/edge from core, minor bug fix #862

Merged
merged 4 commits into from
Mar 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/LightGraphs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export
# Interface
AbstractGraph, AbstractEdge, AbstractEdgeIter,
Edge, Graph, SimpleGraph, DiGraph, SimpleDiGraph, vertices, edges, edgetype, nv, ne, src, dst,
is_directed, add_vertex!, add_edge!, rem_vertex!, rem_edge!,
is_directed,
has_vertex, has_edge, inneighbors, outneighbors,

# core
Expand All @@ -37,6 +37,9 @@ is_ordered, add_vertices!, indegree, outdegree, degree,
neighbors, all_neighbors, common_neighbors,
has_self_loops, num_self_loops, density, squash, weights,

# simplegraphs
add_edge!, add_vertex!, add_vertices!, rem_edge!, rem_vertex!,

# decomposition
core_number, k_core, k_shell, k_crust, k_corona,

Expand Down
6 changes: 3 additions & 3 deletions src/SimpleGraphs/SimpleGraphs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import Base:
import LightGraphs:
_NI, _insert_and_dedup!, AbstractGraph, AbstractEdge, AbstractEdgeIter,
src, dst, edgetype, nv, ne, vertices, edges, is_directed,
add_vertex!, add_edge!, rem_vertex!, rem_edge!,
has_vertex, has_edge, inneighbors, outneighbors,

indegree, outdegree, degree, has_self_loops, num_self_loops, insorted

export AbstractSimpleGraph, AbstractSimpleDiGraph, AbstractSimpleEdge,
export AbstractSimpleGraph, AbstractSimpleEdge,
SimpleEdge, SimpleGraph, SimpleGraphEdge,
SimpleDiGraph, SimpleDiGraphEdge
SimpleDiGraph, SimpleDiGraphEdge,
add_vertex!, add_edge!, rem_vertex!, rem_edge!


"""
Expand Down
31 changes: 0 additions & 31 deletions src/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -124,37 +124,6 @@ Return true if the graph is a directed graph; false otherwise.
"""
is_directed(g) = _NI("is_directed")
is_directed(::Type{T}) where T = _NI("is_directed")
"""
add_vertex!(g)

Add a new vertex to the graph `g`.
Return true if the vertex was added successfully, false otherwise.
"""
add_vertex!(x) = _NI("add_vertex!")

"""
add_edge!(g, e)

Add a new edge `e` to `g`. Return false if add fails
(e.g., if vertices are not in the graph, or edge already exists), true otherwise.
"""
add_edge!(x, e) = _NI("add_edge!")

"""
rem_vertex!(g, v)

Remove the vertex `v` from graph `g`. Return false if removal fails
(e.g., if vertex is not in the graph), true otherwise.
"""
rem_vertex!(x, v) = _NI("rem_vertex!")

"""
rem_edge!(g, e)

Remove the edge `e` from `g`. Return false if edge removal fails
(e.g., if edge does not exist), true otherwise.
"""
rem_edge!(x, e) = _NI("rem_edge!")

"""
has_vertex(g, v)
Expand Down
6 changes: 3 additions & 3 deletions test/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ mutable struct DummyEdge <: AbstractEdge{Int} end

for graphfunbasic in [
nv, ne, vertices, edges, is_directed,
add_vertex!, edgetype, eltype, zero
edgetype, eltype, zero
]
@test_throws ErrorException graphfunbasic(dummygraph)
end

for graphfun1int in [
rem_vertex!, has_vertex, inneighbors, outneighbors
has_vertex, inneighbors, outneighbors
]
@test_throws ErrorException graphfun1int(dummygraph, 1)
end
for graphfunedge in [
has_edge, add_edge!, rem_edge!
has_edge,
]
@test_throws ErrorException graphfunedge(dummygraph, dummyedge)
end
Expand Down