Sebastian,
You might be able to use the numpy.histogramdd function to do the box counting for you: create bins of different sizes, and count the number of non-zero entries in each bin. Something like the following (which you might want to modify to store box sizes rather than box number, input explicit x,y,z ranges, change the default number of levels, etc.):
def boxcount(positions, log2box=(0,10)):
# positions is an Nx3 array of node positions
counts = []
for nboxes in 2**numpy.linspace(log2box[0],log2box[1],log2box[1]+1):
histo = numpy.histogramdd(positions, bins=(nboxes, nboxes, nboxes))
counts.append((nboxes, numpy.count_nonzero(histo[0]>0)))
return numpy.array(counts)
Chris
> On Jul 19, 2017, at 10:01 AM, Daniel Schult <
dsc...@colgate.edu> wrote:
>
> I think NetworkX could be very helpful for you. But node positions are not special attributes in any way so you'll have to for example create functions to find distances yourself.
>
> Basically node attributes can be stored on the graph data structure using `G.node[n]['pos'] = (x, y)`. There are even some graph generators like: random_geometric_graph which assign these values upon creation. You should also take a look at `set_node_attributes` and `get_node_attributes` in the functions module that allow you to easily pull/push dicts to/from the graph e.g. {n: (x,y)}.
>
> The shortest path and longest path should be fairly straightforward. I expect the box covering algorithm to be more involved. That would be a great example, or maybe even a module to submit, if you'd like.
> Dan
>
> On Wed, Jul 19, 2017 at 7:44 AM, sebastian <
seba...@bindgen.net> wrote:
> Dear networkx-user,
>
> I have a general question concerning the usage and the application of networkx. I'm dealing with 3 dimensional fractal networks made of particles. I know the particles positions and the radii (in my simulations particles are monodisperse). I also know the bonds which connect the particles. I planned on running network analysis. The most important evaluations would be the fractal dimension using the box covering algorithm (as suggested by Song et al. 2007). Things like the shortest and longest path between spheres are equally interesting for me.
>
> I had the impression that networkx can be used for such things. But basic questions like: How to place the particles in a box (with respective coordinates) remain unclear to me (I know how to place nodes but not how to attach a possition). Could you help me with that? Maybe I don't have the right idea of the purpose of the software at all?
>
> Kind regards,
> Sebastian
>
> --
> You received this message because you are subscribed to the Google Groups "networkx-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
networkx-discu...@googlegroups.com.
> To post to this group, send email to
networkx...@googlegroups.com.
> --
> You received this message because you are subscribed to the Google Groups "networkx-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
networkx-discu...@googlegroups.com.
> To post to this group, send email to
networkx...@googlegroups.com.