Giter Club home page Giter Club logo

Comments (5)

gboeing avatar gboeing commented on May 13, 2024

@amedury there's a bug in networkx 2.1. To calculate centrality on a line graph, use either nx 2.0 or the unreleased release candidate of 2.2. Will be formally resolved whenever nx 2.2 is released. See also #6

from osmnx-examples.

matthewstidham avatar matthewstidham commented on May 13, 2024

I'm running 2.2 and I am getting the error code NetworkXNotImplemented: not implemented for undirected type when I attempt to run centrality on a directed graph I generated from the from_pandas_edgelist function.

from osmnx-examples.

gboeing avatar gboeing commented on May 13, 2024

What is the type(G) of the graph G you're passing in to the line_graph function?

from osmnx-examples.

matthewstidham avatar matthewstidham commented on May 13, 2024

networkx.classes.graph.Graph
I generated it from

def picturefeeder(text,function):
    keywords = []
    sentences = [x + '.' for x in text.replace('?','.').replace('!','.').split('.')]
    for n in [*range(0,len(sentences)-1)]:
        # Build your graph
        G=nx.from_pandas_edgelist(spacyfunction(sentences[n]),source='textnum',target='parentnum')
        comm = pd.DataFrame(function(G))
        centraldata = pd.merge(pd.DataFrame(comm.mean()),spacyfunction(sentences[n]), left_index=True,right_on='textnum')
        bestnoun = centraldata[centraldata['pos'].isin(['NOUN','PRON'])].sort_values(0,ascending=False).head(1)
        #keywords.append([*bestnoun['text']])
        #keywordsa.append([*bestnoun['textnum']])
        childnodes = centraldata[centraldata['parentnum'] == [*bestnoun['textnum']][0]]
        childnodes = childnodes[childnodes['pos'] != 'PUNCT'][childnodes['pos'] != 'ADP']
        feeder = pd.concat([childnodes,bestnoun])
        #keywords.append([[*bestnoun['text']],[*centraldata[centraldata['parentnum'] == [*bestnoun['textnum']][0]]['text']]])
        keywords.append(' '.join([*feeder.sort_index()['text']]))
    keywords = [x.strip() for x in keywords]
    return keywords

hydrangea is a string made of multiple sentences. spacyfunction is a function which takes that sentence and uses spacy to find its parts of speech, saving as a Pandas Dataframe.

from osmnx-examples.

gboeing avatar gboeing commented on May 13, 2024

@matthewstidham I'm not seeing what your code snippet has to do with OSMnx or the Jupyter notebook that this issue was opened for.

from osmnx-examples.

Related Issues (20)

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.