graphonline | source code of graphonline service
kandi X-RAY | graphonline Summary
kandi X-RAY | graphonline Summary
This is source code of graphonline service. Graphonline helps visualize graph and applies a lot of algorithms.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of graphonline
graphonline Key Features
graphonline Examples and Code Snippets
Community Discussions
Trending Discussions on graphonline
QUESTION
I'm having trouble understanding how Dijkstra finds the shortest path (from the way I understand it works) in the following graph if we have to find the shortest path from 0 to 3: https://graphonline.ru/tmp/saved/SH/SHBqKyENwJqcCJGM.png
If the algorithm chooses the smallest weight from 0 and marks 0 as visited, wouldn't it choose node 1 then node 3? how would it choose node 2?
...ANSWER
Answered 2019-Jun-16 at 03:57From my understanding, the algorithm recalculates the tentative distances of the neighboring, unvisited, vertices before choosing the next vertex to visit. When you are at 1, you first recalculate the tentative distance of its neighboring unvisted vertices, in this case 3. Then choose the unvisited node with the shortest tentative distance, in this case 2, and visit that node.
QUESTION
I'm trying to generate all unique digraphs that fit a spec:
- each node must have exactly 2 inputs
- and are allowed arbitrarily many outputs to other nodes in the graph
My current solution is slow. Eg for 6 nodes, the algo has taken 1.5 days to get where I think it's complete, but it'll probably be checking for a few more days still.
My algorithm for a graph with n
nodes:
generate all
n
-length strings of0
, where one symbol is a1
, eg, for n=3,[[0,0,1], [0,1,0], [1,0,0]]
. These can be thought of as rows from an identity matrix.generate all possible
n * n
matrixes where each row is all possible combinations ofstep 1. + step 1.
This is the connectivity matrix where each cell represents a connection from column-index
to row-index
So, for n=3, these are possible:
[0,1,0] + [1,0,0] = [1,1,0]
[1,0,0] + [1,0,0] = [2,0,0]
These represent the inputs to a node, and by adding step 1 to itself, the result will always represent 2 inputs.
For ex:
...ANSWER
Answered 2017-Nov-02 at 15:37There are a number of approaches you could try. One thing that I do note is that having loops with multi-edges (colored loops?) is a little unusual, but is probably just needs a refinement of existing techniques.
Filter the output of another programThe obvious candidate here is of course nAUTy/traces (http://pallini.di.uniroma1.it/) or similar (saucy, bliss, etc). Depending on how you want to do this, it could be as simple as run nauty (for example) and output to file, then read in the list filtering as you go.
For larger values of n this could start to be a problem if you are generating huge files. I'm not sure whether you start to run out of space before you run out of time, but still. What might be better is to generate and test them as you go, throwing away candidates. For your purposes, there may be an existing library for generation - I found this one but I have no idea how good it is.
Use graph invariantsA very easy first step to more efficient listing of graphs is to filter using graph invariants. An obvious one would be degree sequence (the ordered list of degrees of the graph). Others include the number of cycles, the girth, and so on. For your purposes, there might be some indegree/outdegree sequence you could use.
The basic idea is to use the invariant as a filter to avoid expensive checks for isomorphism. You can store the (list of ) invariants for already generated graphs, and check the new one against the list first. The canonical form of a structure is a kind of invariant.
Implement an algorithmThere are lost of GI algorithms, including the ones used by nauty and friends. However, they do tend to be quite hard! The description given in this answer is an excellent overview, but the devil is in the details of course.
Also note that the description is for general graphs, while you have a specific subclass of graph that might be easier to generate. There may be papers out there for digraph listing (generating) but I have not checked.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install graphonline
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page