Git Product home page Git Product logo

erdos.jl's Introduction

Erdos

Docs CI codecov

A graph library entirely written in Julia. Install it with

]add Erdos

Erdos implements some graph types a large number of algorithms to work with them. Moreover edge and vertex properties can be internally stored in some of the graph types (we call them networks). These features can also be exported to most common graph formats. Custom graph types can be defined inheriting from Erdos' abstract types.

Usage Example

julia> using Erdos

julia> g = Network(10, 20) # create erdos-renyi random network

julia> add_edge!(g, 1, 6); # add edge (1, 6) if it doesn't exists already

julia> eprop!(g, "w", e -> dst(e) - src(e)) # add edge property named "w"
Network(10, 20) with [] graph, [] vertex, ["w"] edge properties

julia> vprop!(g, "x", v -> rand()) # add vertex property named "x"
Network(10, 20) with [] graph, ["x"] vertex, ["w"] edge properties

julia> eprop(g, 1, 6, "w")
5

julia> vprop(g, 1, "x")
0.9016965075429149


julia> writenetwork("mygraph.graphml", g)  # save graph and properties in .graphml format

Features

Refer to the documentation to explore all the features of Erdos. Here is a comprehensive list of the implemente algorithms. (EE) denotes algorithms in the companion package ErdosExtras.

  • core functions: vertices and edges addition and removal, degree (in/out/all), neighbors (in/out/all)

  • maps dictionary like types to store properties associated to vertices and edges

  • networks store vertex/edge/graph properties (maps) inside the graph itself

  • connectivity: strongly- and weakly-connected components, bipartite checks, condensation, attracting components, neighborhood, k-core

  • operators: complement, reverse, reverse!, union, join, intersect, difference, symmetric difference, blockdiag, induced subgraphs, products (cartesian/scalar)

  • shortest paths: Dijkstra, Dijkstra with predecessors, Bellman-Ford, Floyd-Warshall, A*

  • graph datasets: A collection of real world graphs (e.g. Zachary's karate club)

  • graph generators: notorious graphs, euclidean graphs and random graphs (Erdős–Rényi, Watts-Strogatz, random regular, arbitrary degree sequence, stochastic block model)

  • I/O formats: graphml, gml, gexf, dot, net, gt. For some of these formats vertex/edge/graph properties can be read and written.

  • centrality: betweenness, closeness, degree, pagerank, Katz

  • traversal operations: cycle detection, BFS and DFS DAGs, BFS and DFS traversals with visitors, DFS topological sort, maximum adjacency / minimum cut, multiple random walks

  • flow operations: maximum flow, minimum s-t cut

  • matching: minimum weight matching on arbitrary graphs (EE), minimum b-matching (EE)

  • travelling salesman problem: a TSP solver based on linear programming (EE)

  • dismantling: collective influencer heuristic

  • drawing: different graph layouts

  • clique enumeration: maximal cliques

  • linear algebra / spectral graph theory: adjacency matrix, Laplacian matrix, non-backtracking matrix

  • community: modularity, community detection, core-periphery, clustering coefficients

  • distance within graphs: eccentricity, diameter, periphery, radius, center

  • distance between graphs: spectral_distance, edit_distance

Licence and Credits

Erdos is released under MIT License. Graphs stored in the datasets directory are released under GPLv3 License.

Huge credit goes to the contributors of LightGraphs.jl, from which this library is derived. Also thanks to Tiago de Paula Peixoto and his Python library graph-tool for inspiration and for the graphs in datasets.

erdos.jl's People

Contributors

abhijithanilkumar avatar afternone avatar arekfu avatar athulappadan avatar azzaare avatar carlolucibello avatar devmotion avatar epatters avatar femtocleaner[bot] avatar github-actions[bot] avatar hayd avatar iainnz avatar issamt avatar ivirshup avatar jiahao avatar jpfair avatar jpfairbanks avatar juliohm avatar juyeongkim avatar marcliberatore avatar pranavtbhat avatar rlouf avatar sbromberger avatar suzhu1988 avatar tkelman avatar waldyrious avatar yeesian avatar yuyichao avatar zaccranko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

erdos.jl's Issues

make Network the default type?

It would make sense to have as the default type the more flexible Network instead of Graph, so that by default one is able to have graph/edge/vertex property maps.

rebuild! for Graph additional checks

For the time being rebuild! just applies sort! on each vector of the adjacency list.
It should also

  • union!
  • check that if j is in the adjlist of i, also i is in the adjlist of j

edges in collect(edges(g)) should be ordered by index

for the Network type, and more generally for graphs with indexed edges.

Right now edges are iterated in lexycographic order for (src,dst):

julia> g= Network(10,20)
Network(10, 20) with [] graph, [] vertex, [] edge properties

julia> collect(edges(g))
20-element Array{Erdos.IndexedEdge,1}:
 (1=>4,4)  
 (1=>7,11) 
 (1=>5,16) 
 (1=>9,17) 
 (2=>3,7)  
 (2=>9,12) 
 (3=>10,9) 
 (3=>7,10) 
 (3=>8,18) 
 (4=>10,2) 
 (4=>5,5)  
 (4=>6,6)  
 (4=>7,15) 
 (5=>9,1)  
 (5=>6,19) 
 (6=>8,14) 
 (6=>9,20) 
 (7=>9,3)  
 (8=>9,8)  
 (8=>10,13)

Matching with real weights

For the time being matching with continuous weights is roughly rounded to an integer matching problem and solved with BlossomV. This sometimes produces incorrect results (TODO: add failiing example)

Since BlossomV supports conitnuous weights, the BlossomV.jl should compile and expose both versions (integer and float). An attempt is made in mlewe/BlossomV.jl#10

Failed to precompile Erdos, error building BlossomV

I have a problem precompiling module Erdos, related to BlossomV (see the screenshot).

screenshot 68

Then, when I run BinDeps.debug("BlossomV") I get the following message
INFO: Reading build script...
The package declares 2 dependencies.

  • Library "blossom5int32"
    • Providers:
      • Simple Build Process
  • Library "blossom5float64"
    • Providers:
      • Simple Build Process

But again, building BlossomV gives me:
screenshot 69

Does anyone know how to fix this issue?

TagBot trigger issue

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!

Feedback on Detected INSECURE-HTTP

Greetings,

We are some security researchers who have built a scanner to detect known security weaknesses. For your repository, we have found instances of INSECURE-HTTP in the following locations:

Location-1:

xroot["xmlns"] = "http://www.gexf.net/1.2draft"

Location-2:
xroot["xmlns:xsi"] = "http://www.w3.org/2001/XMLSchema-instance"

Location-3:
xroot["xsi:schemaLocation"] = "http://www.gexf.net/1.2draft/gexf.xsd"

Location-4:
xroot["xmlns"] = "http://www.gexf.net/1.3"

Location-5:
xroot["xmlns:viz"]= "http://www.gexf.net/1.3/viz"

Location-6:
xroot["xmlns:xsi"] = "http://www.w3.org/2001/XMLSchema-instance"

Location-7:
xroot["xsi:schemaLocation"]="http://www.gexf.net/1.3/gexf.xsd"

Please give us feedback. Do you think these are valid instances on security weaknesses? Will you fix them?

polish community detection algorithms

maybe use just one method : community_detection(g, algo=ALGX, ....)

Also some of the tests wich intermittently fail on Travis, and are now deactivated (in particular for label propagation), should be changed and reactivated

Attention to escape character ` \ `

At /src/shortestpaths/astar.jl line 49 there is an escape character . It should be removed in order to avoid an invalid syntax ERROR during compilation. In Julia 0.7.0. there are also several WARNINGS easy to fix.

missing algorithms

Here is a partial list of missing algorithms. For hard problems (as most problems in this list) both exact and heuristic solvers should be implemented.

Problems not yet addressed in Erdos

New algorithms for "old" problems

Most problems can be formulated as integer programming problems and solved (at least for small instances) through JuMP and generict IP solver.

Simulated Annealing could be implemented as a general heuristic solver.
See also https://github.com/carlobaldassi/RRRMC.jl.

For most problems message passing heuristics (belief propagation) can be found in the literature

graph visualization libraries

  • ensure compatibility with existing plotting libraries
  • eventually build a new (interactive?) (opengl?) visualization library

add iterable interface to maps

It would be nice to have

for (e, val) in emap
   ....
end

for (v, val) in vmap
   ....
end

An option for an iterator would be

(emap[e] for e in edges(emap.g) if haskey(emap, e))

Impossible to install Erdos with Julia v.1.0

Hello,

I have just installed Julia v1.0 and when I run
import Pkg; Pkg.add("Erdos")
I get the following error message:

Updating registry at ~/.julia/registries/General
Updating git-repo https://github.com/JuliaRegistries/General.git
Resolving package versions...
ERROR: Unsatisfiable requirements detected for package Erdos [90d7349d]:
Erdos [90d7349d] log:
├─possible versions are: [0.1.0, 0.1.2-0.1.3, 0.2.0, 0.3.0, 0.4.0, 0.5.0, 0.6.0-0.6.3] or uninstalled
├─restricted to versions * by an explicit requirement, leaving only versions [0.1.0, 0.1.2-0.1.3, 0.2.0, 0.3.0, 0.4.0, 0.5.0, 0.6.0-0.6.3]
└─restricted by julia compatibility requirements to versions: uninstalled — no versions left
Stacktrace:
[1] #propagate_constraints!#61(::Bool, ::Function, ::Pkg.GraphType.Graph, ::Set{Int64}) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/Pkg/src/GraphType.jl:1005
[2] propagate_constraints! at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/Pkg/src/GraphType.jl:946 [inlined]
[3] #simplify_graph!#121(::Bool, ::Function, ::Pkg.GraphType.Graph, ::Set{Int64}) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/Pkg/src/GraphType.jl:1460
[4] simplify_graph! at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/Pkg/src/GraphType.jl:1460 [inlined]
[5] macro expansion at ./logging.jl:319 [inlined]
[6] resolve_versions!(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/Pkg/src/Operations.jl:338
[7] #add_or_develop#58(::Array{Base.UUID,1}, ::Function, ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/Pkg/src/Operations.jl:1164
[8] #add_or_develop at ./none:0 [inlined]
[9] #add_or_develop#13(::Symbol, ::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/Pkg/src/API.jl:64
[10] #add_or_develop#12 at ./none:0 [inlined]
[11] #add_or_develop at ./none:0 [inlined]
[12] #add_or_develop#11 at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/Pkg/src/API.jl:28 [inlined]
[13] #add_or_develop at ./none:0 [inlined]
[14] #add_or_develop#10 at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/Pkg/src/API.jl:27 [inlined]
[15] #add_or_develop at ./none:0 [inlined]
[16] #add#18 at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/Pkg/src/API.jl:69 [inlined]
[17] add(::String) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/Pkg/src/API.jl:69
[18] top-level scope at none:0

Could anyone help to solve this problem?

Add DefaultMaps

where some value is assumed as a default for any element, unless another value is specifically assigned to that element

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.