mtfishman / datagraphs.jl Goto Github PK
View Code? Open in Web Editor NEWA simple graph type with data on the vertices and edges.
License: MIT License
A simple graph type with data on the vertices and edges.
License: MIT License
Add assigned_vertices
and assigned_edges
iterators, which iterate over the vertices and edges that have assigned data, which in general can be a subset of the vertices and edges of the underlying graph.
Define a generic is_directed(G::Type{<:AbstractDataGraph}) = is_directed(underlying_graph_type(G))
. This would then rely on concrete subtypes implementing underlying_graph_type
.
Inspired by ITensor/ITensorNetworks.jl#9, since it seems like in general we should be able to deduce whether a DataGraph is directed or not from other information.
This anticipates being able to specifying the type of collection the vertex and edge data is stored in, see #11.
For example, remove DataGraph(underlying_graph, String, String)
in favor of DataGraph(underlying_graph; vertex_data_eltype=String, edge_data_eltype=String)
, similar to the syntax of MetaGraphsNext.
This issue is used to trigger TagBot; feel free to unsubscribe.
If you haven't already, you should update your TagBot.yml
to include issue comment triggers.
Please see this post on Discourse for instructions and more details.
If you'd like for me to do this for you, comment TagBot fix
on this issue.
I'll open a PR within a few hours, please be patient!
For example:
julia> DataGraph(grid((4,)), ["X", "Y", "Z", "W"])
ERROR: MethodError: no method matching DataGraph(::SimpleGraph{Int64}, ::Vector{String})
Closest candidates are:
DataGraph(::AbstractGraph) at ~/.julia/dev/DataGraphs/src/datagraph.jl:117
DataGraph(::AbstractGraph, ::Dictionary) at ~/.julia/dev/DataGraphs/src/datagraph.jl:117
DataGraph(::AbstractGraph, ::Dictionary, ::Dictionary) at ~/.julia/dev/DataGraphs/src/datagraph.jl:117
...
Stacktrace:
[1] top-level scope
@ REPL[29]:1
This could automatically convert to a Dictionary
, i.e. get converted internally to:
julia> DataGraph(grid((4,)), Dictionary(["X", "Y", "Z", "W"]))
DataGraph{Int64, String, Any, SimpleGraph{Int64}, Graphs.SimpleGraphs.SimpleEdge{Int64}} with 4 vertices:
Base.OneTo(4)
and 3 edge(s):
Edge 1 => 2
Edge 2 => 3
Edge 3 => 4
with vertex data:
4-element Dictionary{Int64, String}
1 │ "X"
2 │ "Y"
3 │ "Z"
4 │ "W"
and edge data:
0-element Dictionary{Graphs.SimpleGraphs.SimpleEdge{Int64}, Any}
This would only make sense for vertices with linear indexing.
The precedence of data overwriting in union
of DataGraph
s is inconsistent with union
for other types:
julia> using DataGraphs
julia> g1 = DataGraph(4);
julia> g2 = DataGraph(4);
julia> g1[1 => 2] = 1;
julia> g2[1 => 2] = 2;
julia> union(g1, g2)
DataGraph{Int64, Any, Any, Graphs.SimpleGraphs.SimpleGraph{Int64}, Graphs.SimpleGraphs.SimpleEdge{Int64}} with 4 vertices:
Base.OneTo(4)
and 0 edge(s):
with vertex data:
0-element Dictionaries.Dictionary{Int64, Any}
and edge data:
1-element Dictionaries.Dictionary{Graphs.SimpleGraphs.SimpleEdge{Int64}, Any}
Edge 1 => 2 │ 2
compared to:
julia> union(Any[1], Any[1.0])
1-element Vector{Any}:
1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.