Skip to content

Commit 4b2d85d

Browse files
Mal Millercaptchanjack
Mal Miller
authored andcommitted
Transition from LightGraphs to Graphs
1 parent 6631bdf commit 4b2d85d

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

Diff for: Project.toml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
name = "LightOSM"
22
uuid = "d1922b25-af4e-4ba3-84af-fe9bea896051"
33
authors = ["Jack Chan <[email protected]>"]
4-
version = "0.1.18"
4+
version = "0.1.19"
55

66
[deps]
77
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
8+
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
89
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
910
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
10-
LightGraphs = "093fc24a-ae57-5d10-9952-331d41423f4d"
1111
LightXML = "9c8b4983-aa76-5018-a973-4c85ecc9e179"
1212
MetaGraphs = "626554b9-1ddb-594c-aa3c-2596fe9399a5"
1313
NearestNeighbors = "b8a86587-4115-5ab1-83bc-aa920d37bbce"
@@ -19,13 +19,13 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1919

2020
[compat]
2121
DataStructures = "0.17.20, 0.18"
22+
Graphs = "1.4.0"
2223
HTTP = "0.8.17, 0.9"
2324
JSON = "0.21.0"
24-
LightGraphs = "1.3.3"
2525
LightXML = "0.9.0"
26-
MetaGraphs = "0.6.5"
26+
MetaGraphs = "0.7.0"
2727
NearestNeighbors = "0.4.6"
2828
Parameters = "0.12.1"
29-
SimpleWeightedGraphs = "1.1.1"
30-
StaticGraphs = "0.2.0"
29+
SimpleWeightedGraphs = "1.2.0"
30+
StaticGraphs = "0.3.0"
3131
julia = "1"

Diff for: benchmark/benchmarks.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ using Random
22
using BenchmarkTools
33
using LightOSM
44
using OpenStreetMapX
5-
using LightGraphs
5+
using Graphs
66
using DataStructures
77
using JSON
88

@@ -59,16 +59,16 @@ function lg_shortest_path(g::LightOSM.OSMGraph, o_d_indices, algorithm)
5959
if algorithm == :astar
6060
for (o, d) in o_d_indices
6161
try
62-
LightGraphs.a_star(g.graph, o, d, g.weights)
62+
Graphs.a_star(g.graph, o, d, g.weights)
6363
catch
6464
# Error exception will be thrown if path does not exist from origin to destination node
6565
end
6666
end
6767
elseif algorithm == :dijkstra
6868
for (o, d) in o_d_indices
6969
try
70-
state = LightGraphs.dijkstra_shortest_paths(g.graph, o, g.weights)
71-
LightGraphs.enumerate_paths(state, d)
70+
state = Graphs.dijkstra_shortest_paths(g.graph, o, g.weights)
71+
Graphs.enumerate_paths(state, d)
7272
catch
7373
# Error exception will be thrown if path does not exist from origin to destination node
7474
end

Diff for: src/LightOSM.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ using Parameters
44
using DataStructures: DefaultDict, OrderedDict, MutableLinkedList, PriorityQueue, dequeue!, dequeue_pair!
55
using Statistics: mean
66
using SparseArrays: SparseMatrixCSC, sparse
7-
using LightGraphs: AbstractGraph, DiGraph, nv, outneighbors, weakly_connected_components, vertices
7+
using Graphs: AbstractGraph, DiGraph, nv, outneighbors, weakly_connected_components, vertices
88
using StaticGraphs: StaticDiGraph
99
using SimpleWeightedGraphs: SimpleWeightedDiGraph
1010
using MetaGraphs: MetaDiGraph

Diff for: src/graph.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Creates an `OSMGraph` object from download OpenStreetMap network data, use with
1313
- `osm_data_object::Symbol`: OpenStreetMap network data parsed as either XML or Dictionary object depending on the download method.
1414
- `network_type::Symbol=:drive`: Network type filter, pick from `:drive`, `:drive_service`, `:walk`, `:bike`, `:all`, `:all_private`, `:none`, `:rail`, must match the network type used to download `osm_data_object`.
1515
- `weight_type::Symbol=:time`: Weight type for graph edges, pick from `:distance` (km), `:time` (hours), `:lane_efficiency` (time scaled by number of lanes).
16-
- `graph_type::Symbol=:static`: Type of `LightGraphs.AbstractGraph`, pick from `:static` (StaticDiGraph), `:light` (DiGraph), `:simple_weighted` (SimpleWeightedDiGraph), `:meta` (MetaDiGraph).
16+
- `graph_type::Symbol=:static`: Type of `Graphs.AbstractGraph`, pick from `:static` (StaticDiGraph), `:light` (DiGraph), `:simple_weighted` (SimpleWeightedDiGraph), `:meta` (MetaDiGraph).
1717
- `precompute_dijkstra_states::Bool=false`: Set true to precompute dijkstra parent states for every source node in the graph, *NOTE* this may take a while and may not be possible for graphs with large amount of nodes due to memory limits.
1818
- `largest_connected_component::Bool=true`: Set true to keep only the largest connected components in the network.
1919
@@ -63,7 +63,7 @@ Creates an `OSMGraph` object from a downloaded OpenStreetMap network data file,
6363
- `file_path::String`: OpenStreetMap network data file location.
6464
- `network_type::Symbol=:drive`: Network type filter, pick from `:drive`, `:drive_service`, `:walk`, `:bike`, `:all`, `:all_private`, `:none`, `:rail`, must match the network type used to download `osm_data_object`.
6565
- `weight_type::Symbol=:time`: Weight type for graph edges, pick from `:distance` (km), `:time` (hours), `:lane_efficiency` (time scaled by number of lanes).
66-
- `graph_type::Symbol=:static`: Type of `LightGraphs.AbstractGraph`, pick from `:static` (StaticDiGraph), `:light` (DiGraph), `:simple_weighted` (SimpleWeightedDiGraph), `:meta` (MetaDiGraph).
66+
- `graph_type::Symbol=:static`: Type of `Graphs.AbstractGraph`, pick from `:static` (StaticDiGraph), `:light` (DiGraph), `:simple_weighted` (SimpleWeightedDiGraph), `:meta` (MetaDiGraph).
6767
- `precompute_dijkstra_states::Bool=false`: Set true to precompute dijkstra parent states for every source node in the graph, *NOTE* this may take a while and may not be possible for graphs with large amount of nodes due to memory limits.
6868
- `largest_connected_component::Bool=true`: Set true to keep only the largest connected components in the network.
6969
@@ -111,7 +111,7 @@ Downloads OpenStreetMap network data and creates an `OSMGraph` object.
111111
- `download_format::Symbol=:json`: Download format, either `:osm`, `:xml` or `json`.
112112
- `save_to_file_location::Union{String,Nothing}=nothing`: Specify a file location to save downloaded data to disk.
113113
- `weight_type::Symbol=:time`: Weight type for graph edges, pick from `:distance` (km), `:time` (hours), `:lane_efficiency` (time scaled by number of lanes).
114-
- `graph_type::Symbol=:static`: Type of `LightGraphs.AbstractGraph`, pick from `:static` (StaticDiGraph), `:light` (DiGraph), `:simple_weighted` (SimpleWeightedDiGraph), `:meta` (MetaDiGraph).
114+
- `graph_type::Symbol=:static`: Type of `Graphs.AbstractGraph`, pick from `:static` (StaticDiGraph), `:light` (DiGraph), `:simple_weighted` (SimpleWeightedDiGraph), `:meta` (MetaDiGraph).
115115
- `precompute_dijkstra_states::Bool=false`: Set true to precompute dijkstra parent states for every source node in the graph, *NOTE* this may take a while and may not be possible for graphs with large amount of nodes due to memory limits.
116116
- `largest_connected_component::Bool=true`: Set true to keep only the largest connected components in the network.
117117
@@ -360,7 +360,7 @@ function add_weights!(g::OSMGraph, weight_type::Symbol=:distance)
360360
end
361361

362362
"""
363-
Adds a LightGraphs.AbstractGraph object to `OSMGraph`.
363+
Adds a Graphs.AbstractGraph object to `OSMGraph`.
364364
"""
365365
function add_graph!(g::OSMGraph, graph_type::Symbol=:static)
366366
if graph_type == :light

Diff for: src/traversal.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
heuristic::Function=h(u, v) = 0.0,
88
)::Vector{U} where {T <: Real,U <: Integer,V <: Integer,W <: Integer}
99
10-
A* shortest path algorithm taken and adapted from `LightGraphs.jl`. This version improves runtime
10+
A* shortest path algorithm taken and adapted from `Graphs.jl`. This version improves runtime
1111
speed, memory usage, has a more flexible heruistic function, and accounts for OpenStreetMap
1212
turn restrictions.
1313
1414
# Arguments
15-
- `g::AbstractGraph{U}`: LightGraphs abstract graph object.
15+
- `g::AbstractGraph{U}`: Graphs abstract graph object.
1616
- `src::W`: Source vertex.
1717
- `goal::Union{W,Nothing}=nothing`: Optional target vertex as a break condition.
1818
- `distmx::AbstractMatrix{T}=weights(g)`: Optional weight matrix.

0 commit comments

Comments
 (0)