GithubHelp home page GithubHelp logo

isabella232 / grave Goto Github PK

View Code? Open in Web Editor NEW

This project forked from networkx/grave

0.0 0.0 0.0 5.6 MB

Grave—dead simple graph visualization

Home Page: https://networkx.github.io/grave/

License: Other

Python 99.96% Makefile 0.04%

grave's Introduction

Grave—dead simple graph visualization

https://github.com/networkx/grave/workflows/test/badge.svg?branch=main

Logo

Grave is a graph visualization package combining ideas from Matplotlib, NetworkX, and seaborn. Its goal is to provide a network drawing API that covers the most use cases with sensible defaults and simple style configuration. Currently, it supports drawing graphs from NetworkX.

Example

Here, we create a graph and color the nodes in its minimum weighted dominating set:

import matplotlib.pyplot as plt
import networkx as nx
from networkx.algorithms.approximation.dominating_set import min_weighted_dominating_set

from grave import plot_network

network = nx.powerlaw_cluster_graph(50, 1, .2)
dom_set = min_weighted_dominating_set(network)

for node, node_attrs in network.nodes(data=True):
    node_attrs['is_dominator'] = True if node in dom_set else False

def color_dominators(node_attrs):
    if node_attrs.get('is_dominator', False):
        return {'color': 'red'}
    else:
        return {'color': 'black'}

fig, ax = plt.subplots()
plot_network(network, node_style=color_dominators)
plt.show()

The result:

Coloring the minimum weighted dominating set of a graph

License

Released under the 3-Clause BSD license (see LICENSE).

grave's People

Contributors

camillescott avatar choldgraf avatar cj-wright avatar dschult avatar ivanov avatar jarrodmillman avatar nellev avatar tacaswell avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.