Questions tagged [graph]

This "graph" tag refers to a graphical data presentation, e.g. chart or diagram. For the mathematical concept use [graph-theory].

A graph is a visual representation of the relationship between two or more variables. Graphs are especially useful for recognizing broad trends or patterns in large data-sets, and thus are often used for visualising scientific data.

Related tags:


For graphs in discrete mathematics (consisting of nodes/vertices and edges/arcs/relationships which connect pairs of these nodes/vertices), please use . You might also include one of the following tags:

  • for questions on graph-related algorithms.
  • for questions on database technologies for persisting and querying graphs.
28721 questions
76
votes
5 answers

Difference and advantages between dijkstra & A star

I read this: http://en.wikipedia.org/wiki/A*_search_algorithm It says A* is faster than using dijkstra and uses best-first-search to speed things up. If I need the algorithm to run in milliseconds, when does A* become the most prominent choice. From…
AturSams
  • 7,568
  • 18
  • 64
  • 98
74
votes
6 answers

Graph auto-layout algorithm

To simplify the problem, I have a graph that contains nodes and edges which are on a 2D plane. What I want to be able to do is click a button and it make the automatically layout the graph to look clean. By that I mean minimal crossing of edges,…
Cheetah
  • 13,785
  • 31
  • 106
  • 190
72
votes
16 answers

Algorithm for "nice" grid line intervals on a graph

I need a reasonably smart algorithm to come up with "nice" grid lines for a graph (chart). For example, assume a bar chart with values of 10, 30, 72 and 60. You know: Min value: 10 Max value: 72 Range: 62 The first question is: what do you start…
cletus
  • 616,129
  • 168
  • 910
  • 942
71
votes
17 answers

Cycles in an Undirected Graph

Given an undirected graph G=(V, E) with n vertices (|V| = n), how do you find if it contains a cycle in O(n)?
Eran Kampf
  • 8,928
  • 8
  • 49
  • 47
71
votes
12 answers

Millions of 3D points: How to find the 10 of them closest to a given point?

A point in 3-d is defined by (x,y,z). Distance d between any two points (X,Y,Z) and (x,y,z) is d= Sqrt[(X-x)^2 + (Y-y)^2 + (Z-z)^2]. Now there are a million entries in a file, each entry is some point in space, in no specific order. Given any point…
Kazoom
  • 5,659
  • 16
  • 56
  • 69
69
votes
9 answers

Difference between hamiltonian path and euler path

Can some one tell me the difference between hamiltonian path and euler path. They seem similar!
mousey
  • 11,601
  • 16
  • 52
  • 59
68
votes
4 answers

Graphs data structure: DFS vs BFS?

if given a graph problem how do we know whether we need to use bfs or dfs algorithm??? or when do we use dfs algorithm or bfs algorithm. What are the differences and advantages of one over other?
Jony
  • 6,694
  • 20
  • 61
  • 71
68
votes
2 answers

Plotting using a CSV file

I have a csv file which has 5 entries on every row. Every entry is whether a network packet is triggered or not. The last entry in every row is the size of packet. Every row = time elapsed in ms. e.g. row 1 , 0 , 1 , 2 , 117 How do I plot a graph…
user494461
67
votes
5 answers

What is difference between BFS and Dijkstra's algorithms when looking for shortest path?

I was reading about Graph algorithms and I came across these two algorithms: Dijkstra's algorithm Breadth-first search What is the difference between Dijkstra's algorithm and BFS while looking for the shortest-path between nodes? I searched a lot…
harrythomas
  • 1,407
  • 1
  • 13
  • 17
67
votes
4 answers

How to persist a graph data structure in a relational database?

I've considered creating a Vertices table and an Edges table but would building graphs in memory and traversing sub-graphs require a large number of lookups? I'd like to avoid excessive database reads. Is there any other way of persisting a graph?…
Frank Flannigan
  • 1,339
  • 3
  • 16
  • 25
64
votes
5 answers

How to generate dependency graph with text

Is there a simple online tool that will generate a dependency graph (boxes linked by arrow lines) based on text input like: A -> B Much like this one: www.websequencediagrams.com (It generates a sequence diagram)
hello_harry
  • 1,265
  • 2
  • 14
  • 24
63
votes
4 answers

Is there an interactive graphing library for python

I'm looking for an interactive graphing library for Python. By "graph", I meant a set of nodes connected by a set of vertices (not a plot of values over x-y axis, nor a grid of pixels). By "interactive", I meant I can drag-and-drop the nodes around…
Lie Ryan
  • 62,238
  • 13
  • 100
  • 144
63
votes
2 answers

anybody tried neo4j vs titan - pros and cons

Can anybody please provide or point out to a good comparison between Neo4j and Titan? One thing i can see is in terms of scale - Titan is scaleout and requires an underlying scalable datastore like cassandra. Neo4j is only for HA and has its own…
DevD
  • 1,201
  • 2
  • 12
  • 20
63
votes
3 answers

Is Minimum Spanning Tree afraid of negative weights?

This is a follow-up question of Why most graph algorithms do not adapt so easily to negative numbers?. I think Shortest Path (SP) has problem with negative weights, because it adds up all weights along the paths and tries to find the minimum…
Jackson Tale
  • 25,428
  • 34
  • 149
  • 271
62
votes
4 answers

Iterative DFS vs Recursive DFS and different elements order

I have written a recursive DFS algorithm to traverse a graph: void Graph::DFS(Node n) { std::cout << ReadNode(n) << " "; MarkVisited(n); NodeList adjnodes = Adjacent(n); NodeList::position pos = adjnodes.FirstPosition(); …
JohnQ
  • 1,073
  • 2
  • 10
  • 17