FAQ Database Discussion Community

## D3.js network graph using force-directed layout and rectangles for nodes

javascript,d3.js,graph,data-visualization,force-layout
I'm trying to modify Mike's Force-Directed Graph example to use rectangles instead of circles as nodes. Also, I want text inside the rectangle. I have rectangles showing up with text correctly, however they're not attached to the links, and they do not move. Here's a codepen link: http://codepen.io/anon/pen/gpgWaz var width...

## How to group all sibling nodes from different parents by common sibling in a graph using Gremlin/OrientDB

graph,graph-databases,orient-db,gremlin
It is difficult for me to describe. The Gremlin query I am trying to write has one node as an input. Then I am searching all the nodes with class Group of input. Then in each group there is only one Text class node and a number of Elem nodes....

## Graph shortest path confusion

graph,dijkstra,shortest-path
I want to calculate the shortest path from A to F in this graph Following Dijkstra's algorithm I reach E and then go to C, but then I can't comeback to E, how do I solve this? My steps were: All cost to infinity but a, that I've set to...

## How to read DIMACS Vertex-coloring graphs in C++?

c++,boost,graph,boost-graph,graph-coloring
I'm trying to reproduce the experiments carried out in this paper, measuring the performance of an algorithm on the DIMACS Vertex-Coloring benchmark graphs, which can be found here. The graphs are in the DIMACS Standard format, and I'd like to parse them into the C++ Boost Graph Library format, so...

## Where do I find the 'Edmonds' class in networkx?

python,graph,networkx
I am using the networkx framework for graph manipulation in python 2.7. For obtaining an optimal branching (arborescence) from a directed graph, I wanted to use the Edmond's algorithm. On networkx' website, one can find an implementation of that algorithm. The class 'Edmonds' is also listed in the reference. However,...

## Rounded Ends on Circular Graph? iOS?

ios,cocoa-touch,graph,charts
I am trying to reproduce the rounded ends on the circular graph it is not working out for myself. I tried google and cannot find the exact terminology to recreate it. Can anyone lead me in the right direction or tell me what I am looking for ? I want...

## How would i make a circular graph in c#?

c#,animation,graph
hello I am making an application that the design requires special graphs that change depending on the value that is give. like this: how would i go about doing this? could someone point me in the right direction? the outer ring of the orange changes with the value but the...

## Smooth passage from one graph to another

r,graphics,graph
Consider the two following graphs require(ggplot2) set.seed(5276) my_mtcars = mtcars my_mtcars\$rand = rnorm(nrow(mtcars)) ggplot(my_mtcars, aes(rand, mpg)) + geom_point() ggplot(my_mtcars, aes(wt, mpg)) + geom_point() I would like to make a movie (or any animated picture that could easily be introduced in a .ppt) that would make a smooth passage from the...

## Why the graph coding cannot run inside html?

php,html,graph
I want to draw a graph bar but I fail to run it inside html. but when I remove the html code, the coding is running well. Can tell me why is this happen? I search for other method. The coding also not running inside the html. Any way to...

## Find mutually Edges with Spark and GraphX

graph,apache-spark,vertices,edges,spark-graphx
I'm really new to spark and graphx. My question is that if i have a graph with some nodes that have mutual(reciprocally) edges between them, i want to select the edges with a good performace. An example: Source Dst. 1 2 1 3 1 4 1 5 2 1 2...

## get connected components using igraph in R

r,graph,igraph,connected-components
I would like to find all the connected components of a graph where the components have more than one element. using the clusters gives the membership to different clusters and using cliques does not give connected components. This is a follow up from multiple intersection of lists in R My...

## Using BFS for Weighted Graphs

algorithm,graph,shortest-path,bfs
I was revising single source shortest path algorithms and in the video, the teacher mentions that BFS/DFS can't be used directly for finding shortest paths in a weighted graph (I guess everyone knows this already) and said to work out the reason on your own. I was wondering the exact...

## visualizing clr network in cytoscape

r,graph,nodes,igraph,edges
Does anyone know how I can proceed from generating a clr network to visualizing the network nicely using cystoscape? I used minet package to generate a clr network as follows: source("http://bioconductor.org/biocLite.R") biocLite("minet") library(Rgraphviz) library(minet) data(syn.data) mim <- build.mim(syn.data,estimator="spearman") #net<-minet(syn.data,"mrnet","mi.shrink","equalwidth",10) net <- clr( mim, skipDiagonal=1 ) graph <- as(net, "graphNEL") The...

## Large Neo4j graph not showing up

database,graph,neo4j,cypher,graph-databases
I created a large neo4j graph connecting users to the videos they watch like user -> video in a social graph or network type of graph. There are about 9000 user nodes and 20000 video nodes. If I try: MATCH (u)-[:VIEW]->(v) RETURN u,v The graph says "Displaying 300000 nodes, 0...

## Neo4j find nodes with the same properties

graph,neo4j,cypher,nodes
I have a Neo4j graph where each node is a person. Each person has two properties: Name and City. And the relationships are: friend_of and love. I'm trying to get the nodes that have friends ONLY in their same city (A live in Paris, B in Paris, C in Madrid,...

## plot.ly candlestick graph via matplotlib

python,matplotlib,graph,plotly
Using the following example I was able to create a candle stick graph using matplotlib. import matplotlib.pyplot as plt from matplotlib.dates import DateFormatter, WeekdayLocator,\ DayLocator, MONDAY from matplotlib.finance import quotes_historical_yahoo_ohlc, candlestick_ohlc # (Year, month, day) tuples suffice as args for quotes_historical_yahoo date1 = (2004, 2, 1) date2 = (2004, 4,...

## Detecting significant changes in data

c#,algorithm,data,graph,statistics
I have a graph input where the X axis is time (going forwards). The Y axis is generally stable but has large drops and raises at different points (marked as the red arrows below) Visually it's obvious but how do I efficiently detect this from within code? I'm not sure...

## Determining if a graph has a cycle without using DFS

algorithm,graph,cycle,dfs
I came around one of those questions in my exams: Topologocial sorting using Kahn's Algorithm requires the graph to be DAG (Directed Acyclic Graph). How can we determine if a graph contains no cycles without using DFS/BFS first? I am trying to answer that for too long now and I...

## Labelling nodes in networkx

python,graph,beautifulsoup,label,networkx
I'm trying to extract one set of values from a URL. This set has a unique list of numbers. The number of elements in this list should be equal to the number of nodes. So the label that these nodes get should come from the list extracted. How can this...

## Graph shortest path infinite cycle

graph,dijkstra,shortest-path
So my paint skills are not the best but I think it shows the example well. Imagine I want to calculate the shortest path between A and C, considering all the algorithms I've found are greedy, wouldn't it be stuck in an infinite cycle between A and B? Any...

## Overlaying n (user generated) points over a graph

python,matplotlib,graph,points
print "Enter the amount of points you would like to generate to estimate Pi" n = raw_input() plt.xlim((0,1)) plt.ylim((0,1)) x = numpy.linspace(0,1,500) y = numpy.sqrt(1-x**2) for i in range(int(n)): xcoordinate = random.random() ycoordinate = random.random() plt.scatter(xcoordinate, ycoordinate) plt.plot(x,y,'g') plt.show() I'm trying to get n random points scattered across this graph....

## Highlighting specific ranges on a Graph in R

r,graph,highlight
library(season) plot(CVD\$yrmon, CVD\$cvd, type = 'o',pch = 19,ylab = 'Number of CVD deaths per month',xlab = 'Time') if i wanted to highlight a region of the graph based on x values say from 1994-1998 how do i do this? Any thought would be appreciated Thanks....

## Responsive axis with percentage coordinates

javascript,svg,d3.js,graph,charts
In an attempt to build a responsive scatter graph with d3.js, I'm using %-based coordinates in a 100% x 100% svg element. How can I .call(axis) and get it to layout the axis using % and not px values, so that they always fit the svg and the plotted data?...

## How to traverse an graph branch, from specific node with Boost.Graph?

c++,boost,graph
Will be grateful for help . I have tree structure and want print nodes in order of occurrence, with respect of hierarchy . For example I wan traverse all child of N1: [N0, N1[N2, N3, N4[N5], N6] And I'm expect to get N1 N2 N3 N4 N5 But I'm receive...

## Graph algorithm to collect all edges which are on any path between two nodes

algorithm,graph,graph-algorithm
I need to find all edges which are on any path between two nodes [src, dest] in a directed graph. Means that each edge (from base to head) has to satisfy: there is a path from src to base there is a path from head to dest I could collect...

## Code knight's tour using backtracking is not showing any output

c++,c,graph
This code is not giving any output. It should output a matrix of 8X8 size. #include <iostream> #define N 8 using namespace std; This function prints the matrix: void print(int arr[][N]){ int i, j; for (i = 0; i < N; i++){ for (j = 0; j < N; j++)...

## Set label on group multiplot in gnuplot

linux,graph,plot,gnuplot
Im plotting one picture with 4 different graphs using gnuplot. Labels for their x and y axes have the same meaning. If Im plotting it like this: set multiplot layout 2,2 rowsfirst set xlabel "x" set ylabel "y" set title offset -3,-3 set xrange [20:70] set yrange [0:15000] set title...

## calculating graph weight in python with NetworkX

python,graph,networkx,dijkstra
I'm using networkx to calculate the shortest distance(in terms of weight) between two vertexes in a directed, weighted graph. I think that the dijkstra_path_length algorithm is the right one to use here, but I don't understand what I have to put as a default parameter for the weight in order...

## Plotting a data frame in R

r,graph,data.frame
I have this data frame and I'd like to know if there's a way to plot this using the ggplot2 library (or anything that works). The first row has a bunch of zip codes and the second row contains weather data (temperature in this case) associated with the corresponding zip...

## How to create boost subgraph with setS vertices list?

c++,boost,graph
The following code has errors: AAA.cpp:23:15: required from here .../boost/include/boost/graph/subgraph.hpp:333:5: error: static assertion failed: (!is_same<edge_index_type, boost::detail::error_property_not_found>::value) AAA.cpp:27:21: error: no matching function for call to ‘add_vertex(foo(int, char**)::<anonymous enum>, Graph&)’ AAA.cpp:27:21: note: candidates are: .../boost/include/boost/graph/subgraph.hpp: In instantiation of...

## Number of shortest paths in weighted graph

algorithm,graph
This is the question: Given a directed graph G=(V,E), a source vertex s \$epsilon V, we know that all cycles in G are of positive weight ( > 0). Also we are given the graph after Bellman-Ford was run on it, meaning that for each v in V we know...

## How to create an adjacency matrix from an input?

c,graph
Say I have the following raw data: 5 6 1 4 5 2 4 5 2 3 4 3 4 6 where first line represents: [number of vertices] [number of edges] and the subsequent lines represent: [index of vertex1] [index of vertex2] [weight]. I was thinking of doing %3 and...

## Update minimum spanning tree if edge is removed

algorithm,graph,tree,runtime,big-o
I am having trouble with the following question: Assume we have already found a minimum spanning tree T for a weighted, undirected graph G = (V,E). We would like to be able to efficiently update T should G be altered slightly. An edge is removed from G to produce a...

## Big O Notation with Absolute Value?

graph,big-o,notation
I'm going through some programming interview question books, and I've seen reference to "O(|A|)" time complexity. I've never seen this notation with the absolute value given. Some research led me to Big O Cheatsheet that references this notation under the graphs section. The problem I'm researching is about partitioning an...

## How do graphing applications calculate viewing area?

c#,wpf,excel,graph
I am working on an application that displays a scatterplot of data but I am wondering what the "rule of thumb" is that graphing applications use to calculate the Y-axis maximum and minimum viewing area values. For example, in the graph below, the chart displays values from ~40 minutes to...

## Is there a way to access fonts icons from html5 canvas?

javascript,graph,html5-canvas
I am new to html5 canvas. I need to display fonticons (fontawesome) as images. Is this possible? Thanks...

## C - Segmentation fault when adding edge to graph

I have to use an undirected weighted graph (adjacency matrix) for this program. typedef struct graph { int n; /* Number of vertices */ Boolean *visited; /* Will be later used */ double **mat; /* It has to be a double */ } Graph; Function used to initialize the graph:...

## Assigning a label to a created node in Neo4jClient

c#,graph,neo4j,neo4jclient
I want to create some nodes of type Person and Books using Neo4jClient. To do that, I have class Person like this: Public Class Person { Public String Name; } To create node, I have written something like this: Var RefA = client.Create(new Person(){Name ="John"}); (Client -> GraphicClient) When I...

## Generate states for depth first search

java,algorithm,graph,graph-algorithm,depth-first-search
So while practicing on USACO, I got stuck on this question. Question Description : There are N lamps in the room (all are initially switched on). There are 4 switches for the lamps with each switch toggles specific lamps like: Switch 1 : Toggles all the lamps Switch 2 :...

## Find the minimum weight cycle that contains a specific edge

algorithm,graph
given a graph: - oriented, - strongly connected and - weighed (the weights are all positive) I have to write a function that taken as input an edge (u, v), calculate the weight of the cycle of minimum weight that contains this edge. I thought I'd do as follows but...

## BEMSimpleLineGraph X-Axis Labels not showing for phones newer than iPhone 5

graph,bemsimplelinegraph
I've created a line graph using BEMSimpleLineGraph Pod, but, for the life of me, can't figure out why the x-Axis labels aren't showing up on any device newer that an iPhone 5. EDIT: I should mention enableXAxisLabel = YES by default. Here is the code to lay out the graph:...

## Plot: Add legend that overlay several Frames

r,graphics,graph,plot
How can we write a legend that overlay several frames? Using the xpd parameter, the legend can exit its frame but still cannot enter the next frame. par(mfrow=c(1,2)) plot(rnorm(120), rnorm(120)) legend(x = -0.1, y=0.1, legend = "Legend that covers both plots", text.col="red", cex=2, box.col="red", xpd=TRUE) plot(rnorm(120), rnorm(120)) One dummy solution...

## Update minimum spanning tree if edge is added

algorithm,graph,tree,runtime,big-o
I have a possible solution for the following question, but not sure if correct: Assume we have already found a minimum spanning tree T for a weighted, undirected graph G = (V,E). We would like to be able to efficiently update T should G be altered slightly. An edge is...

## Travels using graph

c++,algorithm,graph
Someone can help me to think in the better way to adapt Dijkstra's Algorithm in these conditions? All I thought didn't was good. Example of input: GP4578 MADRID 01:00 PORTO 02:00 IK6587 PORTO 03:00 VALENCIA 05:00 05:30 TENERIFE 08:00 AB5874 VALENCIA 05:40 BERLIM 10:00 "VALENCIA 05:00 05:30" This is a...

## Find a MST in O(V+E) Time in a Graph

algorithm,graph,graph-algorithm,minimum-spanning-tree
Similar question has been asked before, as in http://cs.stackexchange.com/questions/28635/find-an-mst-in-a-graph-with-edge-weights-from-1-2 The question is: Given a connected undirected graph G=(V,E) and a weight function w:E→{1,2}, suggest an efficient algorithm that finds an MST of the graph in O(V+E) without using Kruskal. I had a look at the suggested solutions on the thread...

## Prolog isomorphic graphs

graph,prolog,isomorphism
Good night. Trying to solve the isomorphic graphs problem here. Assignment info: Determine whether 2 undirected graphs are isomorphic. No isolated vertices. Number of vertices is less than 30 Edges of graphs are given as predicates, i.e. e(1, 2). f(1, 2). I'm trying to use the following approach: For every...

## Plotting multivariate time-series data in R

r,graph,plot,ggplot2,time-series
My data looks like this: > head(Full.df) Date Month Week Year Count.S Count.G Count.W Count.F 1 2006-01-02 2006-01-01 2006-01-02 2006-01-01 0 7 9 6 2 2006-01-03 2006-01-01 2006-01-02 2006-01-01 0 13 12 4 3 2006-01-04 2006-01-01 2006-01-02 2006-01-01 0 13 15 4 4 2006-01-05 2006-01-01 2006-01-02 2006-01-01 0 20 6...

## Azure Graph API

api,azure,graph,azure-active-directory,graph-api-explorer
Even though I've added apps from gallery to Azure AD, I cannot see when i try to pull the data. But i can see the custom apps added. Like if I've added 7 apps; 2 from gallery(Google Docs, One drive) & 5 custom(native/web apps); I am able to see only...

## Tree searching algorithm

string,algorithm,search,graph,tree
I'm looking for suggestions on strategies for searching a tree-like data structure. The structure is a tree where each element is a string, each branch is a period, and a path is the concatenation of several strings and periods starting at the root. The root and edges from the root...

## Read One Input File and plot multiple

python,numpy,matplotlib,graph,plot
I am trying to read one input file of below format. Where Col is x axis and Col is y axis and col is some name. I need to plot multiple line graphs for separate names of col. Eg: Name sd with x,y values will have one line graph and...

## Color issue rendering a Cartesian Plane

javascript,graph,html5-canvas
I want to make mid-line as red. But doing so makes all the lines red that are drawn after mid-line. Following is my JavaScript code for making a graph in html5 Canvas: var c = document.getElementById("myCanvas");// Accessing Canvas element var graph = c.getContext("2d"); var posX = 100; var posY =...

## Draw a graph in opengl

c++,opengl,graph
I want to create a graph (2d graph) with my code, How can I make a simple 2d graph in opengl? I'm new in opengl, so maybe you can explain me how is the code works, please. by the way here is my code : #include <iostream> using namespace std;...

## Minimum sum of multiple source-destination path

algorithm,graph,minimization
Given an undirected and unweighted graph, I want to find out the minimum sum of k pair of source-destination path, under the constraint that each vertex is used at most once. For example, the following graph with 2 pair source-destination (A, E) and (B, F) has minimum sum of 7...

## Bound mismatch using DoubleSupplier

java,graph
I created a class that implements the Dijkstra algorithm on graph. public class Dijkstra<V, E extends DoubleSupplier> { ... } When I try to test this class with JUnit, the compiler generates this error: Bound mismatch: The type Integer is not a valid substitute for the bounded parameter of the...

## How to test if a weighted graph has a negative cycle

java,graph,bellman-ford
I need to create a test that returns true if the graph (directed graph) as a parameter has a cycle of negative weight, false otherwise. For now I created this. Theoretically should check if there are "generic" cycles, not if there are negative cycles. How can I change the method?...

## Plotting Areas from an Integer Valued Matrix in MATLAB

arrays,matlab,graph,area
Suppose I have some NxM array called L in which each entry contains one of four integers, let's say 0,1,2,3. Each number is grouped within the array, i.e. The upper right side of L will be entirely 1, and the lower left will be all 2 and the middle will...

## How to iterate through a vector of nodes

c++,vector,graph,dijkstra,shortest-path
I am implementing Dijkstra's shortest path algorithm. I have made a node class as follows: node::node(int to,int weight) { this->to = to; this->weight = weight; } I have made a graph class as : class Graph { int V,E; vector<node> *adj; public : Graph(int V,int E); void addEdge(int v,int w,int...

## GDI+ curve “overflowing”

c#,graphics,graph,gdi+
I'm currently using GDI+ to draw a line graph, and using Graphics.DrawCurve to smooth out the line. The problem is that the curve doesn't always match the points I feed it, and that makes the curve grow out of the graph frame in some points, as seen below(red is Graphics.DrawLines,...

## Plot multiple frames of different size on the same window

r,graphics,graph,plot
Consider this example: par(mfrow=c(2,3)) frame() image(matrix(1:100, nrow=100), main="my wide plot", axes=FALSE) frame() plot(rnorm(120), rnorm(120), main="plot 1") plot(dpois(0:20, lambda=6), type="b", main="plot 2") x = rnorm(100) y = x+runif(100, 10, 12) plot(x=x, y=y, , main="plot 3") How can I do to make my first graph (image(...) titled my wide plot) to occupy...

## Scala: initializing vertexes of a graph

list,scala,graph
I have something like this: def vertices: List[Vertex] = List() def edges: List[Edge] = List() def adjMatrix: Array[Array[Int]] = Array.ofDim[Int](vertices.size, vertices.size) def addVertex(lbl: Char) = { val vertex = new Vertex(lbl) vertex :: vertices vertex } class Vertex(label: Char) { val visited: Boolean = false def echo() = print(label) }...

## Run time error in graph

algorithm,graph,union-find
I am implementing Graph for the first time and for that I took this problem from SPOJ. Took help of geeksforgeeks, applied union find algorithm to find out whether or not graph contains a cycle but I get run time error (SIGSEGV). Can you please help why is it so?...

## Algorithm that returns sets of vertices that are equal distance (not infinite) by a Vertex

algorithm,graph,directed-graph,bfs
Write an algorithm that, given a graph G and a vertex t of G, returns sets of vertices that are equal distance (not infinite) by t. The graph G is the following: Considering t = A, the algorithm should return: Set of vertices at distance 0: {A} Set of vertices...

## Construct bipartite graph from columns of python dataframe

python,graph,dataframes,networkx
I have a dataframe with three columns. data['subdomain'], data['domain'], data ['IP'] I want to build one bipartite graph for every element of subdomain that corresponds to the same domain, and the weight to be the number of times that it corresponds. For example my data could be: subdomain , domain,...

## How to divide a graph into two sets having maximum interset connection?

algorithm,graph
I have a undirected graph , i want to divide it into two group in which intergroup connections are maximum and connection in same group are as minimum as possible.

## Read CSV and plot colored line graph

python,csv,matplotlib,graph,plot
I am trying to plot a graph with colored markers before and after threshold value. If I am using for loop for reading the parsing the input file with time H:M I can plot and color only two points. But for all the points I cannot plot. Input akdj 12:00...

## Modifying Dijkstra's Algorithm to find shortest path with largest weighting

java,algorithm,graph,nodes,dijkstra
I'm in need of a piece of code that finds the shortest path between nodes with the greatest weighting. For example, the quickest route from A to D, but with the greatest weighting: - B- --E / \ / A D \ / \ C - -F So right now...

## How to create compass plot graph in Excel?

excel,graph
I really enjoy the format of the political compass I have seen online, I was wondering if it's possible to create my own using x and y axis? Here are my data that I wish to graph: "Stamford, CT",-38,-25 "Atlanta, GA",-31,-37 "Melbourne, FL",-27,-38 "Huntsville, AL",-26,-39 "Houston, TX",-28,-32 "San Jose, CA",-39,-15...

## R order a table for barplot by predefined settings

r,graph,order,bar-chart
I have a table that looks like this: cos_table<-table(df\$COS) #simply count the frequency of COS in the table A B C D 2880 6001 834 2833 When I plot it with barplot(cos_table) I get a bar plot with the order of A B C D My request is to organize...

## Find all possible paths between two nodes in a directed graph

c#,graph,path-finding
I have directed graph which comes with an adjacency matrix and a start state + a target state. I need an algorithm to find all possible paths between these two nodes using adjacency matrix and implement it in C#. I don't understand how BFS and DFS can help me in...

## map/set iterator not dereferencable. Multimap container isse

c++,graph,multimap
I'm geting this error message map/set iterator not dereferencable When trying to get value by key in multimap. In this code I'm trying to show nonoriented graph represented by adjacency list (vector<Vertex*> vertexList) void NonOrGraph::show() { cout << endl; multimap<int, int> used; for (int i = 0; i < vertexList.size();...

## How to query collection using cypher in neo4j?

java,graph,neo4j,cypher,spring-data-neo4j
I have one node in neo4j whose structure looks like: { "nodeId": 32, "id": "0290cf88-3345-4c30-8e5f-7ce0cb3f0b6b", "type": "User", "name": "Mahendra", "index": 0, "data": "This is sample user", "description": null, "contentBlocks": [], "icon": null, "createdOn": null, "modifiedOn": null, "properties": { "displayName": "Mahendra", "lastName": "Kawde" }, "tags": [ "tag1", "tag2" ], "categories": null...

## Read graphs from file as fast as possible

c,input,graph,text-files
I have a txt file that contains 2 graphs and the number of vertices in the following format: 6 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 1 0 0 1 0 1 0 1 0 0 0 0 1 0 1 0...

## Get only the nodes related with bidirectional relatioship

graph,neo4j,cypher,nodes,relationship
I have a neo4j graph where A-[r:LOVE]->B and B-[r:LOVE]->A. I'm trying to get all the nodes with that bidirectional relatioship (some nodes for example C-[r:LOVE]->B but B not love C) and I must get them only 1 time (i don't want to get them duplicated) and ordered by name. I'm...

## undirected weighted graph data structure in c++

c++,class,c++11,data-structures,graph
I am learning C++ and I appreciate your support by answering my question to help me to understand fundamental concepts. I am sure I need to learn many stuff, but I need a some advice to help me to find the right way. The problem I have is explained in...

## Clustering network nodes by attributes

r,graph,plot,igraph,edges
I have a data.frame similar to d as follows. d <- structure(list(ID = c("KP1009", "GP3040", "KP1757", "GP2243", "KP682", "KP1789", "KP1933", "KP1662", "KP1718", "GP3339", "GP4007", "GP3398", "GP6720", "KP808", "KP1154", "KP748", "GP4263", "GP1132", "GP5881", "GP6291", "KP1004", "KP1998", "GP4123", "GP5930", "KP1070", "KP905", "KP579", "KP1100", "KP587", "GP913", "GP4864", "KP1513", "GP5979", "KP730", "KP1412", "KP615", "KP1315",...

## cut the tree by removing edges

java,data-structures,graph,tree,edge
Question :- removal of an edge from a given tree T will result in the formation of two separate trees, T1 and T2. Each vertex of the tree T is assigned a positive integer. Your task is to remove an edge, such that the Tree_diff of the resultant trees is...

## Javascript multiple circular graphs

javascript,html,graph
Ive made a working circular graph using javascript, and Ive run into a problem. The script fetches the id of the graph in order to work, but I would like multiple graphs. So here is my question: How do I make the script compatible with multiple graphs? I tried fetching...

## Best graph algorithm for least transfer in an electric grid

c++,graph,graph-algorithm
I'm given a series of cities, and each one produces an amount of electricity and needs an amount of electricity. Each city has up to 8 adjacent cities, and I am trying to minimize the number of transfers. If A->B 10 energy, total cost of transfer is 10. If A->B->C...

## Algorithm Is Node A Connected to Node B in Graph

python,algorithm,graph
I am looking for an algorithm to check for any valid connection (shortest or longest) between two arbitrary nodes on a graph. My graph is fixed to a grid with logical (x, y) coordinates with north/south/east/west connections, but nodes can be removed randomly so you can't assume that taking the...

## How do I make a decaying oscilating function in python?

python,numpy,matplotlib,graph,physics
I have a code in python to represent the energy decay in a damped oscilator, it reads like this: def E(wt, Q): return (np.e**(-x/Q))*(1-(1/2*Q)*np.sin(2*x)) x = np.linspace(0,20,1000) y0 = E(x,2) y1 = E(x,4) y2 = E(x,8) y3 = E(x,16) plt.plot(x, y0, 'p', label=r'\$Q=2\$') plt.plot(x, y1, 'r', label=r'\$Q=4\$') plt.plot(x, y2, 'g',...

## EdgeValue isnt the same after calling Vertex.getEdgeValue() twice

I'm trying to implement the Spinner graph partitioning algorithm in giraph. In the first steps, my program adds edges to a given input graph so that it becomes an undirected graph and every vertex chooses a random partition. (This partition-integer is stored in the VertexValue) At the end of this...

## Android Plotting 2D Graph

java,android,user-interface,graphics,graph
I am developing one app and I want to show 2D (x-y coordinates) graph, in my activity. I have looked on internet there are lots of third party libs capable of drawing graphs. But I am looking for android built in lib or widget, which will draw graph. Also is...

## Sum of products of edges of all paths in DAG

algorithm,matlab,graph
I have a directed acyclic graph with weighted edges. My goal is to find the sum of products of edges in all paths between "the first" and "the last" levels. For example, in this case this would be 2*3 + 2*1 + 4*2 + 4*4 + 3*3 + 3*1 +...

## Disconnect all vertices in a graph - Algorithm

algorithm,graph
I am looking for an algorithm that finds minimal subset of vertices such that by removing this subset (and edges connecting these vertices) from graph all other vertices become unconnected (i.e. the graph won't have any edges). Is there such algorithm? If not: Could you recommend some kind of heuristics...

## Get set of edges

java,graph
I seem to have problem with using/understanding sets. In JGraphT there is a function edgeSet(). I would like to store all edges in the array, so I did this: DefaultWeightedEdge edgesContained[]= (DefaultWeightedEdge[]) Graph.edgeSet().toArray(); //compiler returns this line as one with error for ( int i=0; i<=numberOfEdges; i++) { setRandomWeight(edgesContained[i], randomWeight());...

## android- I need to design 180 degree graph (half pie chart )

android,graph
I need to design half pie chart in Android, I have searched a lot but can't find any solution. Any idea for a library to do that? Or can I make this manually? Thank you in advance. ...

## Find node having two distinct relationship in Cypher

graph,neo4j,cypher,relationship
I am a newbie in Cypher. I am trying to find a query which will returns nodes having more than one relationship to other nodes. Please refer to http://neo4j.com/docs/snapshot/images/cypher-match-graph.svg for the structure. I am trying to find the person who has acted in some movie(s) and also a father. When...

## How to add axis labels to a simple.scatterplot (UsingR)

r,graph,label
The package UsingR has some great out of the box plotting tools. However, using the simple.scatterplot function I can't figure out how to add axis labels. library(UsingR) simple.scatterplot(iris\$Sepal.Length, iris\$Sepal.Width, xlab='hello axis') Error in plot.default(x, y, xlim = xrange, ylim = yrange, xlab = "x", : formal argument "xlab" matched by...

## Building a directed multigraph (Python)

python,dictionary,graph,hypercube
Lets say I get one list which represents the weights to adjacent nodes. The multigraph is shaped like a hypercube. The nodes will be named by their coordinates as a binary string. En example for n=3 bin_string = ['000', '100', '010', '001', '110', '101', '011', '111'] weights = [[-5, -13,...

## sort graph by distance to end nodes

algorithm,sorting,graph,distance
I have a list of nodes which belong in a graph. The graph is directed and does not contain cycles. Also, some of the nodes are marked as "end" nodes. Every node has a set of input nodes I can use. The question is the following: How can I sort...

## Optimal memory trace for a DAG of dependency evaluations

algorithm,memory,graph,compiler-optimization,directed-acyclic-graphs
I'm looking for an algorithm which to optimise the order of evaluations on a DAG, such that least memory is used. It might be a bit harder to explain, so I'll give an example what I mean. Consider that you have a DAG with multiple roots, which represents some form...

## Airport travels using graph

c++,graph,shortest-path
Can someone help me to think of a better way to adapt Dijkstra's Algorithm in these conditions? All I thought of so far wasn't good. Example of input: GP4578 MADRID 01:00 PORTO 02:00 IK6587 PORTO 03:00 VALENCIA 05:00 05:30 TENERIFE 08:00 AB5874 VALENCIA 05:40 BERLIM 10:00 "VALENCIA 05:00 05:30" This...

## When adding a random edge to a graph, which bridge edges are not bridge edges any longer?

algorithm,graph,graph-algorithm
A random edge e is added to a graph. It happens to not be a bridge edge. Let C be the connected component of the endpoints of e. Given the list L of all the bridge edges of C (before e was added), which is the fastest algorithm to find...

## Plotting image and points on Matlab GUI via update function

image,matlab,user-interface,graph,plot
excuse my noobness, but this is my first post. i generated this gui in matlab, and i want to plot an image on one of the axis from an update function. i know in Matlab you can just do something like image(img) hold on plot(x1,z1) hold off but how can...

## Solving Steiner Tree with GLPK

graph,ampl,glpk
I'm new at using the GPLK and I'm trying to solve the Steiner Tree problem through it. The mathematical formulation I'm using is this one: This is the piece of code I'm testing: # Number of terminal vertexes param p, integer; # Number of steiner vertexes param s, integer; #...

## R / SQL /Python : Extracting connected components from node-edge pairs

python,sql,r,graph,connected-components
I struggle to come up with a title that describes what I'm trying to solve, so please comment if you have a better title! The solution can be in R, Python, or SQL (Aster TeraData SQL to be exact, though a solution any SQL language is very helpful for learning...

## Heuristic to find the maximum weight independent set in an arbritary graph

algorithm,graph,graph-algorithm,linear-programming,np-complete
The MWIS (Maximum weight independent set) is a NP-complete problem, so if P!=NP we cannot find a solution in a good enough time complexity. I am looking for an algorithm that can find an approximation of the MWIS in an arbitrary graph within a good time complexity. I am currently...

## I am trying to remove a single value from a MultiMap(org.apache.commons.collections.MultiMap) in JAVA

java,collections,graph,hashmap
I am trying to remove a single value from a MultiMap (org.apache.commons.collections.MultiMap) in Java. The issue is it contains two values. When I remove one, the other gets removed as well. class MappedValue { public MappedValue(String id , boolean touched) { identifier = id; this.touched=touched; } private String identifier; private...

## write_graphviz does not work when vertex list is setS?

c++,boost,graph
The following code has errors: cannot bind ‘std::basic_ostream’ lvalue to ‘std::basic_ostream&& #include <boost/graph/graphviz.hpp> void foo(int,char*[]) { using namespace boost; typedef boost::adjacency_list< boost::setS, // outedge list boost::setS, // vertex list boost::directedS, // undirected boost::no_property, // vertex prop boost::no_property, // edge prop boost::no_property, // graph prop boost::setS // edgelistc > Graph; Graph...

## Where to place a method which checks if two edges are parallel in a graph?

java,oop,graph,uml,software-engineering
I'm divided as to where to place a method which checks whether two edges are parallel in a graph. In the UML class diagram seen below, I have placed my suggestions in notes. The figure depicts that a Graph consits of Edges and Vertices. Two edges are parallel if they...