"None" when trying to graph in Django with Networkx

683 views Asked by At

I'm currently working on a project that requires connected nodes. I've tried finding some decent Python graphing tools and arrived at Networkx. Say that I have an office, and this office has several departments with employees. I'd like the employees to be connected to the department, but first of all I'm just trying to show the departments.

def department(request):
    context=RequestContext(request)
    G = nx.Graph()
    deps= models.Department.objects.all()
    for d in deps:
        G.add_node(d)
    return HttpResponse(nx.draw_circular(G))

However, this just gives me a "None" when I try to run it. There are currently two departments in my database. Does anyone have any ideas? Many thanks in advance!

0

There are 0 answers