graph-algorithm

Finding coordinates of Koch Curve

时间秒杀一切 提交于 2021-02-19 07:37:40
问题 Sorry for my language since English is my second language. I am trying to convert a straight line into a fractal known as Koch curve. The 2 points of the straight line are given and then I need to create the Koch curve where I divide the line to 3 segments and then make the second segment an equilateral triangle. See http://www.tgmdev.be/curvevonkoch.php. So far we convert the straight line to 4 equally segments, and I need to figure out all the coordinates of the Koch curve. I have thought

Graph “Vertex cover” brute algorithm

风流意气都作罢 提交于 2021-02-11 17:44:49
问题 Given an electrical network, which is a set of electric generators, between which wires are stretched. A wire has current if at least one generator is operating at one end of the wire. Find the set with minimum count of generators that need to be turned on to provide current to the entire network. I found some extra information that can help. It is "Vertex cover problem". Now we know that it hasn't special algorithm. Let's bruteforce? 回答1: As you note in the question, this is an instance of

overlapping edges in DirectedWeightedGraph in JGraphT using mxCircleLayout

一个人想着一个人 提交于 2021-02-11 16:41:01
问题 Running below code on an already constructed Graph (usind ArbEdge.class as Edges) Graph<String, ArbEdge> graph = new DefaultDirectedWeightedGraph<>(ArbEdge.class); public void pngGraph() { JGraphXAdapter<String, ArbEdge> graphAdapter = new JGraphXAdapter<String, ArbEdge>(this.getGraph()); mxIGraphLayout layout = new mxCircleLayout(graphAdapter); // mxParallelEdgeLayout layout = new mxParallelEdgeLayout(graphAdapter); layout.execute(graphAdapter.getDefaultParent()); BufferedImage image =

overlapping edges in DirectedWeightedGraph in JGraphT using mxCircleLayout

谁说胖子不能爱 提交于 2021-02-11 16:39:01
问题 Running below code on an already constructed Graph (usind ArbEdge.class as Edges) Graph<String, ArbEdge> graph = new DefaultDirectedWeightedGraph<>(ArbEdge.class); public void pngGraph() { JGraphXAdapter<String, ArbEdge> graphAdapter = new JGraphXAdapter<String, ArbEdge>(this.getGraph()); mxIGraphLayout layout = new mxCircleLayout(graphAdapter); // mxParallelEdgeLayout layout = new mxParallelEdgeLayout(graphAdapter); layout.execute(graphAdapter.getDefaultParent()); BufferedImage image =

overlapping edges in DirectedWeightedGraph in JGraphT using mxCircleLayout

家住魔仙堡 提交于 2021-02-11 16:38:30
问题 Running below code on an already constructed Graph (usind ArbEdge.class as Edges) Graph<String, ArbEdge> graph = new DefaultDirectedWeightedGraph<>(ArbEdge.class); public void pngGraph() { JGraphXAdapter<String, ArbEdge> graphAdapter = new JGraphXAdapter<String, ArbEdge>(this.getGraph()); mxIGraphLayout layout = new mxCircleLayout(graphAdapter); // mxParallelEdgeLayout layout = new mxParallelEdgeLayout(graphAdapter); layout.execute(graphAdapter.getDefaultParent()); BufferedImage image =

Minimum removed nodes required to cut path from A to B algorithm in Python

北城以北 提交于 2021-02-07 19:54:16
问题 I am trying to solve a problem related to graph theory but can't seem to remember/find/understand the proper/best approach so I figured I'd ask the experts... I have a list of paths from two nodes (1 and 10 in example code). I'm trying to find the minimum number of nodes to remove to cut all paths. I'm also only able to remove certain nodes. I currently have it implemented (below) as a brute force search. This works fine on my test set but is going to be an issue when scaling up to a graphs

Minimum removed nodes required to cut path from A to B algorithm in Python

余生长醉 提交于 2021-02-07 19:54:08
问题 I am trying to solve a problem related to graph theory but can't seem to remember/find/understand the proper/best approach so I figured I'd ask the experts... I have a list of paths from two nodes (1 and 10 in example code). I'm trying to find the minimum number of nodes to remove to cut all paths. I'm also only able to remove certain nodes. I currently have it implemented (below) as a brute force search. This works fine on my test set but is going to be an issue when scaling up to a graphs

How to split continous attribute in CART decision tree algorithm?

拈花ヽ惹草 提交于 2021-02-07 10:21:55
问题 I don't understand about how to split continous attribute in CART (Classification and Regression Tree) algorithm, as we know that CART can both split categorical and continous attribute. i have read many papers and it says the value to be split point is the middle value in sequence. i don't understand about it. could you explain to me what that means, and give me some examples? thanks 回答1: The general process is to scan through candidate splitting values on any given predictor, measure the

Finding “bubbles” in a graph

喜夏-厌秋 提交于 2021-01-29 05:59:37
问题 In a game, we have a universe described as a strongly-connected graph full of sectors and edges. Occasionally there are small pockets, players call them 'bubbles', where a small group of nodes all access the rest of the network through a single node. In the graph below, sectors 769, 195, 733, 918, and 451 are all only reachable via node 855. If you can guard 855 effectively, then those other sectors are safe. Other nodes on the chart have more edges (purple lines) and aren't 'bubbles' in the

Graphic: Rerouting problem test in python language

邮差的信 提交于 2021-01-29 05:37:07
问题 Your company has N servers. The information flows from one server to another through a connection. If the information flows from server i to server j , then connection (i) = j. It's possible for some server connection(i) = i, meaning information doesn't flow further. You are given an array connection consisting of N integers. You are tasked with making minimum number of changes to connection array values so that the information from all server can reach at exactly one server in the whole