Giter VIP home page Giter VIP logo

zincbase's People

Contributors

tomgrek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

zincbase's Issues

more comments in basis.py

If you want to start a visualisation on zincbase.web,
you look up the code on basic.py.

Though it is very easy example I couldnt get the whole code because of missing comments.
Commenting would increase the developer experience on zincbase.

Spacing in Networkx Graph with mod to spring layout

Hello!

I noticed that the graphing feature, by default, presents a networkx graph of the nodes and edges; however, the spacing can become a bit tight in the layout.

For either a feature enhancement or for anyone interested in spacing out the edges and nodes, consider the following modification to zb.py

   # currently around line 829 and 830 ...
    def plot(self, density=1.0):
        """Plots a network diagram from (triple) nodes and edges in the KB.

        :param float density: Probability (0-1) that a given edge will be plotted, \
        useful to thin out dense graphs for visualization."""
        edgelist = [e for e in self.G.edges(data=True) if random.random() < density]
        newg = nx.DiGraph(edgelist)
        pos = nx.spring_layout(newg)
        # ...

The code above leads to a dense plot as provided by plot1.png

Whereas the code below leads to some more spacing for the figure in plot2.png.
plot1
plot2

If changed to:

    # code extract to demonstrate enhanced layout
    def plot(self, density=1.0):
        """Plots a network diagram from (triple) nodes and edges in the KB.

        :param float density: Probability (0-1) that a given edge will be plotted, \
        useful to thin out dense graphs for visualization."""
        edgelist = [e for e in self.G.edges(data=True) if random.random() < density]
        newg = nx.DiGraph(edgelist)
        # modification here!
        # this creates some spacing to make tight clusters more readable and could be configured further with 
        # values for K and seed
        pos = nx.spring_layout(newg, k=5 / math.sqrt(newg.order()), seed=0)
        # ...

TypeError: draw_networkx_edges() got an unexpected keyword argument 'font_size'

Hello, great library! I am making great use of it!

There is a slight issue with the plot() call to networkx.

In zb.py, around line 833, the script returns a networkx error when setting the parameter of font_size.

# line 833 of zb.py
nx.draw_networkx_edges(newg, pos, edgelist=edgelist, width=1, font_size=8)

The line of code above returns an error like the following:

TypeError: draw_networkx_edges() got an unexpected keyword argument 'font_size'

In my local, simply removing the font_size param from this call results in a successful networkx graph of my knowledge base.

# this works
nx.draw_networkx_edges(newg, pos, edgelist=edgelist, width=1)

I am not 100% sure, but based on the networkx function signature, it seems that the font_size param is not supported for draw edges.

Python3 ModuleNotFoundError: No module named 'graph'

Hi,

I stumbled upon module not found error in MacOS 10.14.3 (Mojave).

I have tried to install graph-tools in python3 and graph-tool deps via Homebrew.

❯ python3 examples/countries.py
Traceback (most recent call last):
  File "examples/countries.py", line 8, in <module>
    from zincbase import KB
  File "/usr/local/lib/python3.7/site-packages/zincbase/__init__.py", line 1, in <module>
    from .zincbase import KB
  File "/usr/local/lib/python3.7/site-packages/zincbase/zincbase.py", line 20, in <module>
    from graph import Node
ModuleNotFoundError: No module named 'graph'

Any idea how to make it work?

I cant dump a knowledge base object with pickle

If I try to dump a medium complex kb with pickle, I get the exception

`'NoneType' object is not callable

A short google search shows me, that not every class can be dumped. It looks like
the knowledge base class should support this feature.`

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.