Symmetric(or undirected) Hamiltonian Cycle data sets - graph

I would like to test my recently created algorithm on large (50+ node) graphs. Preferrably, they would specifically be challenging graphs, and known tours would exist (for at least most of them).
Problem sets for this problem do not seem as easy to find as with the TSP. I am aware of the Flinder's challenge set available at http://www.flinders.edu.au/science_engineering/csem/research/programs/flinders-hamiltonian-cycle-project/fhcpcs.cfm
However, they seem to be directed. I can probably alter my algorithm to work for directed, but it will take time and likely induce bugs. I'd prefer to know if it can work for undirected first.
Does anyone know where problem sets are available? Thank you.
quick edit:
Now I am unsure if the flinder's set is directed or not.... It doesn't say. Examples make it seem like maybe it actually is undirected.

Check this video:
https://www.youtube.com/watch?v=G1m7goLCJDY
Also check the in depth sequel to the video.
You can determine yourself how many nodes you want to add to the graph.
It does require you to construct the data yourself, which should be deable.
One note: the problem is about a path, not a cycle, but you can overcome this by connecting the start and end node.

Related

Graph data structure visualization

Hello I have got an assignment to write a program, which will visualize a Graph, implemented in any way. I have no problem in implementing Graph, but I have no idea how can I visualize it.
The rules are:
- include graphs with vertex and edge labels, directed and non-directed;
- drawing clarity (avoiding large clusters of vertices and edges, avoiding cutting edges and breaking them in many places)
Do you have any tips or suggestions which language or tool should I use to do it, or when can I find help to deal with this type of problem, I'd be glad. I don't know how to make anything graphic, never done that. I am coding mostly in Java, Python and C++, but I am not advanced.
I am working on a similar problem. The approach I'm working with currently has been first creating a node, then animating it, and repeating for all nodes
https://dl1683.github.io/DataStructuresInJavaScript/index.html.
The Github code might be useful to you. I am not a web dev guy so be careful about doing everything I did.

Linear programming to find a graph circuit

The question itself is pretty simple... This is a vechicle routing problem.
I have a directed graph
I need to get a linear programming model that will somehow tell me the shortest circuit that visits all nodes, and starts and ends at the star. You are allowed to go over an edge more than once. A node is any crossing on the image.
We had like 4 hours of this in class, I have no idea where to even start...
I'm not expection anyone to give me the full model, but I was hoping someone would tell a strategy so I could do this.
Thank you in advance.
I would start from Dijkstra's algorithm for undirected graphs. There are some variants with similar or better performance. Take a look at https://en.wikipedia.org/wiki/Shortest_path_problem#Undirected_graphs, pick a choice, and keep us informed ... :)
The answer here seems to be very easy. (That is, very easy in theory, very hard and a lot of work to code in practice).
This seems like a straight-forward TSP (Travelling Salesperson Problem). Read about some general literature on TSP. You need to set up and solve a TSP where your nodes are the "cities" in a TSP. You also need to include your star as a city in the TSP.
The Dijkstra algorithm will not give you a solution. The Dijkstra algorithm is used for finding fastest/shortest paths between a node and other nodes in a (typically road-) network. However, distance-wise your problem is super-simple: Getting the cheapest travel cost (and path) from one node to another node in your problem is (almost) trivial.
If you are to solve this problem "for real" (not just discuss it), you need to acquire a TSP solver that is able to take your network (both edges and nodes) as input. Your input needs to specify which edges are directed and which are uni-directed. A lot of work in practice: Even if you use a tool, you still need to familiarize yourself with the tool.

graph databases and Eulerian path

I am studying graph databases (Neo4J).
I know graph databases come from graph theory, which has basis on Euler paper to solve the 7 bridges problem.. eulerian path/eulerian circuit.
I am trying to find an example, something, to show how graph databases use the Eulerian path to solve some problem.
Ideally I would need a real example from a source, but even any help to understand this better.. thanks!
I believe you have a misimpression. Even though Euler wrote a paper based on the 7 bridges problem (which was probably the first paper on graph theory), that does not mean that the design of neo4j uses his solution to that specific problem in any way.

Trees / Graphs, How to represent Multiple parents and children?

I'm hoping you can help me out with some technical questions on graphs/trees.
I'm trying to display the creation of objects in systems.
It's really a tree structure.
It has some interesting requirements.
a)
One node can have many children. Say 20. Maybe more.
ie. one library can be used by many objects.
b)
A child node can have many parents. Say up to 20.
ie. many libraries are used by one procedure or object
c)
A particular node can appear in more than one place.
ie. a generic print, or logging function is called in many procedures
Note: This is just an -example- in tech terms I expect you will understand.
It is NOT the issue I need to model. No need to discuss it.
As I've thought about it, I realized that it's not a simple binary tree, or a linked list.
1)
What kind of data structure could I save all the data in?
2)
How could I produce a graph of this in java?
3)
What is a free open source graphing software that could graph such a tree?
Such as Neo4j
Perhaps in formats:
- as a tree, with a root, trunk, branches, and leaves?
- Like the graphs you see now, depicting social networks, with the root node in the center?
4)
Any good websites, or tutorials on this subject?
Thanks a lot!
Check out prefuse. It's old but it works. You'll have to invest a bit of time to learn how to use it though. Once you get there, it's just a matter of creating a prefuse.data.Graph object and fill in your nodes and their neighbors and then creating the visualization.
If you're open to other solution check out d3.js - draw graph using javascript on SVG element in your browser.
If this is really about objects, then maybe UML can help. It's designed to generate graphs of object relationships. There are tons of free UML tools out there. I'd download one and see if you can shoehorn your application into it.
JGraphT can represent your graph structure and can use JGraph for visualisation.
For an example visualization, look at this.

Graph data structures in LabVIEW

What's the best way to represent graph data structures in LabVIEW?
I'm doing some basic algorithm review over the holiday, and I'd prefer to not implement all of the storage and traversals myself, if possible.
(I'm aware that there was a thread a few years ago on LAVA, is that my best bet?)
I've never had a need to do this myself, so I never really looked into it, but there are some people who did do some work as far I know.
Brian K. has posted something over here, although it's been a long time since I looked at it:
https://decibel.ni.com/content/docs/DOC-12668
If that doesn't help, I would suggest you read this and then try sending a PM to Daklu there, as he's the most likely candidate to have something.
https://decibel.ni.com/content/thread/8179?tstart=0
If not, I would suggest posting a question on LAVA, as you're more likely to find the relevant people there.
Well you don't have that many options for graphs , from a simple point of view. It really depends on the types of algorithms you are doing, in order to choose the most convenient representation.
Adjacency matrix is simple, but can be slow for some tasks, and can be wasteful if the graph is not dense.
You can keep a couple of lists and hash maps of your edges and vertices. With each edge or vertex created assigned a unique index into the list,it's pretty simple to keep things under control. Each vertex could then be associated with a list of its neighbors. Depending on your needs you could divide that neighbors list into in and out edges. Also depending on your look up needs, you could choose to index edges by their in or out edge or both, or simple by a unique index number.
I had a glance at the LabView quick reference, and while it was not obvious from there how you would do that, as long as they have arrays of some sort, you can implement a graph. I'm sure you'll be fine.

Resources