graph-theory

Finding polygons within an undirected Graph

爷,独闯天下 提交于 2019-12-19 08:04:50
问题 Please see Image: http://i.stack.imgur.com/NPUmR.jpg I have an undirected graph which contains one or more connected sub graphs. The graph is defined by a set of ordered pairs of connected vertices. There may be upto 300 vertices. The graph is planar. I need to identify polygons as shown in the Image. Each of the coloured areas in a separate polygon. A rough heuristic could be that polygons are "enclosed regions" between closed edge loops (cycles) in the graph. It's been suggested in similar

Suggestions for KSPA on undirected graph

僤鯓⒐⒋嵵緔 提交于 2019-12-19 03:14:16
问题 There is a custom implementation of KSPA which needs to be re-written. The current implementation uses a modified Dijkstra's algorithm whose pseudocode is roughly explained below. It is commonly known as KSPA using edge-deletion strategy i think so. (i am a novice in graph-theory). Step:-1. Calculate the shortest path between any given pair of nodes using the Dijkstra algorithm. k = 0 here. Step:-2. Set k = 1 Step:-3. Extract all the edges from all the ‘k-1’ shortest path trees. Add the same

Suggestions for KSPA on undirected graph

折月煮酒 提交于 2019-12-19 03:14:07
问题 There is a custom implementation of KSPA which needs to be re-written. The current implementation uses a modified Dijkstra's algorithm whose pseudocode is roughly explained below. It is commonly known as KSPA using edge-deletion strategy i think so. (i am a novice in graph-theory). Step:-1. Calculate the shortest path between any given pair of nodes using the Dijkstra algorithm. k = 0 here. Step:-2. Set k = 1 Step:-3. Extract all the edges from all the ‘k-1’ shortest path trees. Add the same

Efficently simulate rolling weighted dice (or traversing a weighted graph), with frequent updates

我们两清 提交于 2019-12-18 16:52:23
问题 I have a weighted, directed graph which is dense with around 20,000 nodes. Given an node in the graph, I choose an adjacent node randomly with a probability related to the relative weights. After each choice, I receive feedback about whether the choice was good or bad, and update the network. For example, after a bad choice I decrease the weight of all edges pointing to the chosen node. I learned yesterday about the alias method for simulating rolling a weighted die, which is the same as

Connect nodes to maximize total edge weight

倖福魔咒の 提交于 2019-12-18 14:08:09
问题 I am working on a problem which could be reduced to a graph optimization problem as below. A set of colored nodes is given. They are all unconnected i.e. there is no edge in the graph. The edges are to be inserted between the nodes. A node can have only 4 edges at max. A table provides rules for profit contribution from the edges. Eg., An edge connecting red to red: profit is 10 An edge connecting red to blue: profit is 20 The total number of nodes is around 100. The total number of colors is

Javascript directed acyclic graph library? (Graph visualization is NOT necessary)

自古美人都是妖i 提交于 2019-12-18 13:22:20
问题 I have a dataset which is best represented by a graph. It consists of nodes of 6 or 7 different "types" with directed edges (dependencies on one another, guaranteed not to have cyclic dependencies). The dataset is essentially a template of a layered configuration, and the user needs to be able to select bits and pieces of the configuration from different layers which are desired, and have the dependent bits be brought in automatically. The general UI need is for a user to select or un-select

How to assign the same style to a group of edges?

好久不见. 提交于 2019-12-18 12:47:33
问题 I've got a graph that I want graphviz to layout and visualize for me. The graph has 122 edges and 123 nodes. The edges are of 4 different kinds and I want them to be visually distinguishable. However I've not yet decided what would be the best way of doing that, I'd like to play around with the dials a bit. Unfortunately I do not see anything like a "class" or "stylesheet" attribute for edges. I can only set visual attributes individually for every edge (lots of repetition). Perhaps I've

Finding All Connected Components of an Undirected Graph

。_饼干妹妹 提交于 2019-12-18 12:36:35
问题 I have a list of objects (undirected edges) like below: pairs = [ pair:["a2", "a5"], pair:["a3", "a6"], pair:["a4", "a5"], pair:["a7", "a9"] ]; I need to find all components (connected nodes) in separate groups. So from given pairs I need to get: groups = [ group1: ["a2", "a5", "a4"], group2: ["a3", "a6"], group3: ["a7", "a9"] ]; I actually read some answers on here and googled this and that's how I learned this is called "finding connected components in a graph" but, could't find any sample

Finding the longest cycle in a directed graph using DFS

浪子不回头ぞ 提交于 2019-12-18 12:16:50
问题 I need to find the longest cycle in a directed graph using DFS. I once saw this Wikipedia article describing the way of doing this, and I think it approached the problem something like marking the node with one of three states: Node not yet visited, Finished searching the node, and Node visited, but not yet finished visiting. I would be grateful if anyone could share the link with me. By the way, it isn't Tarjan's Algorithm. The problem below is what I'm trying to solve, in case you'd like to

How to draw a graph in LaTeX?

亡梦爱人 提交于 2019-12-18 09:54:58
问题 First of all, let me say I'm using LyX, though I have no problem using ERT. Secondly, what is the most simplest way to draw a simple graph like this in Latex? I've seen some documents with graphs and I've seen some examples, but I couldn't figure out how to just draw a simple graph - what packages do I need, etc? 回答1: TikZ can do this. A quick demo: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} [scale=.8,auto=left,every node/.style={circle,fill=blue!20}] \node