Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Are you considering using networkx? #4

Open
ironhouzi opened this issue Feb 4, 2018 · 8 comments
Open

Are you considering using networkx? #4

ironhouzi opened this issue Feb 4, 2018 · 8 comments

Comments

@ironhouzi
Copy link

ironhouzi commented Feb 4, 2018

NetworkX is the most common graph library for Python, and I was expecting this client to be utilizing it.

What are your thoughts on utilizing it?

@swilly22
Copy link
Contributor

An interesting idea,
Let me experiment a bit with NetworkX to see if it's a good match

@DeadWisdom
Copy link

NetworkX is mostly about it's wonderful library of algorithms which, using a Redis module, wouldn't do much. I could see matching its interface (which is already basically there), and allowing easy transfer from NetworkX to Redis Graph and back again.

@swilly22
Copy link
Contributor

@DeadWisdom thanks,
As I've said above I'm not that familiar with NetworkX, I'll have to read the docs and play with it a bit before deciding rather or not to add support (not sure about details) for RedisGraph to it.

@RedisGraph RedisGraph deleted a comment from Liangchengdeye Apr 17, 2018
@RedisGraph RedisGraph deleted a comment from Liangchengdeye Apr 17, 2018
@schwab
Copy link

schwab commented Nov 23, 2018

This is an interesting idea, especially if graphs (ie match query results) could be pushed through the networkx library to have it output visualizations. One of the impediments I've been running into while converting an existing sql system to use redis graph, is that the "not-so-command-line-literate" of my colleagues are very dependent on visual tools to help them understand our data. Without something akin to column-row grid based sql tools, they are very confused by graphs. I know this is an education issue, but a usable graph visualization tool ( perhaps as a plugin to rediscommander), would go a long way towards bridging that gap. A quick way to get something useable and open innovation up to others would be an option to have redisgraph output graphs formatted in one or more of networkx's supported formats (GML, GraphML, json, adjacency lists etc). Then a simple load call followed by a draw would produce visualizations.

@vsraptor
Copy link

vsraptor commented Apr 9, 2019

any news on this ...

@swilly22
Copy link
Contributor

swilly22 commented Apr 9, 2019

@vsraptor, not much to update, we're currently working on restructuring our resultset format, the new structure will enable others to easily construct a visual representation of the result-set.

@schwab
Copy link

schwab commented Oct 31, 2019

Checkout RedisInsight which has a graph visualization when you return nodes and relationships in a query.

@vsraptor
Copy link

vsraptor commented Aug 15, 2020

quick and dirty .. for starters ..
if from redis-cli you can call script and pass the result set as csv-tuples ... it will be very easy to chain to this function.


def draw(triple_lst):
	graph = nx.DiGraph(directed=True	)
	plt.figure()
	options = {
		'node_color': '#aaaaff',
		'node_size': 700,
		'width': 2,
		'arrowstyle': '-|>',
		'arrowsize': 12,
		'with_labels':True,
		'font_weight':'bold',
	}

	for triple in triple_lst :
		n1 = graph.add_node(triple[0])
		n2 = graph.add_node(triple[1])
		graph.add_edge(triple[0],triple[1], weight=f'{triple[2]:.2f}')
	pos = nx.spring_layout(graph)	
	nx.draw_networkx(graph, **options, pos=pos)
	edge_labels = nx.get_edge_attributes(graph, 'weight')
	nx.draw_networkx_edge_labels(graph, pos=pos, label_pos=0.5, edge_labels=edge_labels)
	return graph

draw(obj.graph.query("match (n1)-[e]->(n2) return n1.val, n2.val, e.val").result_set)

Figure_1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants