2024-02-26 10:18:17 +0200 received badge ● Famous Question (source) 2023-11-30 10:10:30 +0200 received badge ● Famous Question (source) 2023-01-10 02:27:12 +0200 received badge ● Notable Question (source) 2023-01-10 02:27:12 +0200 received badge ● Popular Question (source) 2022-06-30 09:00:11 +0200 received badge ● Popular Question (source) 2021-06-17 07:17:57 +0200 received badge ● Notable Question (source) 2020-04-16 21:00:31 +0200 received badge ● Notable Question (source) 2020-04-16 21:00:31 +0200 received badge ● Popular Question (source) 2019-08-07 17:22:14 +0200 received badge ● Popular Question (source) 2018-03-07 13:21:06 +0200 asked a question Flow gives error for disconnected vertices When calculating the flow between to vertices which are not connected in a graph, the method returns a ValueError. I would have assumed that it would just return 0. Here's a minimal example: G=Graph({0:[],1:[]}) G.flow(0,1) # raises the error ValueError: vertex '0' is not in the (di)graph  If on the other hand one tries the shortest_path method it just returns a empty list, since there is not path between 0 and 1. G.shortest_path(0,1) #returns []  2018-03-05 12:14:38 +0200 received badge ● Nice Question (source) 2018-03-05 10:28:47 +0200 asked a question Error with is_prime I'm getting an error message when trying to check if a certain graph is prime with the following code: G=Graph({ 1:[4,9,19,26], 2:[4,26], 3:[4,22], 4:[5,6,7,8,16,17,21,27,1,2,3], 5:[9,13,22,26,4], 6:[9,13,26,4], 7:[9,4], 8:[9,13,22,4], 9:[10,11,12,16,20,24,1,5,6,7,8], 10:[19,9], 11:[13,9], 12:[13,19,26,9], 13:[14,15,16,17,18,27,5,6,8,11,12], 14:[26,13], 15:[22,13], 16:[19,26,4,9,13], 17:[19,22,4,13], 18:[19,22,13], 19:[20,21,23,24,25,1,10,12,16,17,18], 20:[22,9,19], 21:[22,4,19], 22:[23,24,27,3,5,8,15,17,18,20,21], 23:[26,19,22], 24:[26,9,19,22], 25:[26,19], 26:[27,1,2,5,6,12,14,16,23,24,25], 27:[4,13,22,26] }) G.is_prime()  which gives me the following error message: Error in lines 30-30 Traceback (most recent call last): File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1013, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 1, in File "/ext/sage/sage-8.1/local/lib/python2.7/site-packages/sage/graphs/graph.py", line 7233, in is_prime D = self.modular_decomposition() File "/ext/sage/sage-8.1/local/lib/python2.7/site-packages/sage/graphs/graph.py", line 7199, in modular_decomposition return relabel(D) File "/ext/sage/sage-8.1/local/lib/python2.7/site-packages/sage/graphs/graph.py", line 7197, in relabel = lambda x : (x.node_type, [relabel(_) for _ in x.children]) if x.node_type != NodeType.NORMAL else id_label[x.children[0]] File "/ext/sage/sage-8.1/local/lib/python2.7/site-packages/sage/graphs/graph.py", line 7197, in relabel = lambda x : (x.node_type, [relabel(_) for _ in x.children]) if x.node_type != NodeType.NORMAL else id_label[x.children[0]] KeyError: 27  2017-10-13 16:00:23 +0200 asked a question Edge color for undirected multiedge graphs It seems that there is a bug with specifying the color of undirected multiedges. Here's an example: G=graphs.PathGraph(2) G.allow_multiple_edges(True) G.add_edge((0,1)) G.plot(edge_colors={"red":[(1,0)]})  The graph plotted has then four edges, two black and two red. It seems that the multiedge to be colored red is seen as a different one than the already present one, even though they are actually the same since the graph is undirected. I get the intended plot if I change the last line to: G.plot(edge_colors={"red":[(0,1)]})  2017-03-14 14:50:46 +0200 commented answer Updating graph plot Thanks, using animations worked well :) 2017-02-23 13:17:35 +0200 received badge ● Supporter (source) 2017-02-23 11:27:23 +0200 asked a question to_directed() affects original graph I've stumbled on what I think is a bug. When you create a directed graph from some original graph and then making changes on the new, this can affect the old one. I'm not sure if it should be like this and one should always copy the graph first. Here's a minimal example that for be gives an error "KeyError: 0". G1=graphs.RandomGNP(5,0.5) G1.plot(save_pos=True) G2=G1.to_directed() G2.delete_vertex(0) G2.add_vertex(5) G2.plot() G1.plot()  2017-01-19 09:29:05 +0200 asked a question Updating graph plot I wish to visualize a algorithm running on a graph. How can I update the plot of a graph after for example deleting a vertex or to change color of a vertex without generating another plot window? 2017-01-08 13:28:44 +0200 received badge ● Scholar (source) 2017-01-08 13:28:39 +0200 commented answer Legend for histogram Perfect, thanks! :) 2017-01-08 05:45:07 +0200 received badge ● Student (source) 2017-01-07 13:52:15 +0200 asked a question Legend for histogram I can't make the legend for histograms work as I want it to. I can make a legend with the labels appear but the corresponding indicator doesn't show the colors just two black vertical lines. Here's a minimial example: d1=[randint(0,10) for i in range(20)] d2=[randint(0,10) for i in range(20)] h=histogram([d1,d2],label=["d1","d2"]) h.legend(True) h  Any ideas?