amount of recheable objects from a root one?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

amount of recheable objects from a root one?

Mariano Martinez Peck
Hi folks. I need to do something and I am a little lazy to do it. Maybe someone already did it and can share it with me. I want to take an object X. That object has references to other objects and I imagine that as a graph.

I need to traverse the graph, and get the final amount of reachable objects from the object X. I mean, the size of that graph. I need to avoid cycles and not count objects already counted. Maybe I can reuse part of SmartRefStream?

Thanks for any tip.

Mariano

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: amount of recheable objects from a root one?

Adrian Lienhard
Hi Mariano

Any reason not to use image segments? It even includes a method doSpaceAnalysis to count the number of instances per class. In addition you may have take the objects in the outpointers collection into account.

Cheers,
Adrian

On Jun 27, 2010, at 14:41 , Mariano Martinez Peck wrote:

> Hi folks. I need to do something and I am a little lazy to do it. Maybe
> someone already did it and can share it with me. I want to take an object X.
> That object has references to other objects and I imagine that as a graph.
>
> I need to traverse the graph, and get the final amount of reachable objects
> from the object X. I mean, the size of that graph. I need to avoid cycles
> and not count objects already counted. Maybe I can reuse part of
> SmartRefStream?
>
> Thanks for any tip.
>
> Mariano
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: amount of recheable objects from a root one?

Miguel Cobá
In reply to this post by Mariano Martinez Peck
El dom, 27-06-2010 a las 14:41 +0200, Mariano Martinez Peck escribió:
> Hi folks. I need to do something and I am a little lazy to do it.
> Maybe someone already did it and can share it with me. I want to take
> an object X. That object has references to other objects and I imagine
> that as a graph.
>
> I need to traverse the graph, and get the final amount of reachable
> objects from the object X. I mean, the size of that graph. I need to
> avoid cycles and not count objects already counted. Maybe I can reuse
> part of SmartRefStream?

What about Magma's Ma object serialization and Ma traverse object
graphs' packages. I think they can  be used independently from Magma to
do what you need.

Cheers

>
> Thanks for any tip.
>
> Mariano
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

--
Miguel Cobá
http://miguel.leugim.com.mx


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: amount of recheable objects from a root one?

Noury Bouraqadi-2
In reply to this post by Mariano Martinez Peck

On 27 juin 2010, at 14:41, Mariano Martinez Peck wrote:

> Hi folks. I need to do something and I am a little lazy to do it. Maybe someone already did it and can share it with me. I want to take an object X. That object has references to other objects and I imagine that as a graph.
>
> I need to traverse the graph, and get the final amount of reachable objects from the object X. I mean, the size of that graph. I need to avoid cycles and not count objects already counted. Maybe I can reuse part of SmartRefStream?
>
Why not using ReferenceStream? It is supposed to handle your problem.

Noury



_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: amount of recheable objects from a root one?

Mariano Martinez Peck
In reply to this post by Adrian Lienhard


On Sun, Jun 27, 2010 at 3:42 PM, Adrian Lienhard <[hidden email]> wrote:
Hi Mariano

Any reason not to use image segments?

actually yes....I don't know why but it seems I have 0 objects in the segment and few objects in outPointers....I will digg into it and see if I find the problem.

I finally did what Noury suggested and use SmartRefStream. It seems the instVar 'objCount' has what I wanted.

Thanks.

mariano
 
It even includes a method doSpaceAnalysis to count the number of instances per class. In addition you may have take the objects in the outpointers collection into account.

Cheers,
Adrian

On Jun 27, 2010, at 14:41 , Mariano Martinez Peck wrote:

> Hi folks. I need to do something and I am a little lazy to do it. Maybe
> someone already did it and can share it with me. I want to take an object X.
> That object has references to other objects and I imagine that as a graph.
>
> I need to traverse the graph, and get the final amount of reachable objects
> from the object X. I mean, the size of that graph. I need to avoid cycles
> and not count objects already counted. Maybe I can reuse part of
> SmartRefStream?
>
> Thanks for any tip.
>
> Mariano
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project