How to check if multiple objects are linked in a continuous way?

1 vue (au cours des 30 derniers jours)
Marc Laub
Marc Laub le 22 Juin 2020
Commenté : Marc Laub le 22 Juin 2020
Hey,
I have multiple handle class objects from a handle class.
I now link them to each other under certain circumstances which shouldn't be relevant here.
Is there a way to check if they are linked in a continous way or if I made 2 or more subsystems whihc arent linked together?
So when I have the objects A,B,C,D,E and F and want them linked for example:
A--> B,C,D
B--> A,C,F
C--> A,F,E
D--> A,F,C
E--> C,B,A
F--> B,C,D
and not like:
A--> B,C
B--> A,C
C--> A,B
D--> E,F
E--> D,F
F--> D,E
the number of linked objects is not constant and can vary between 3 and open end.
But in the second case, all objects are linked but its linked in a wise that there are 2 subsystems, ABC and DEF.
So what I nedd it to get From object(i) to object(j) by going from neighbour to neighbour. If that is impossible the linking failed for my purpose.
But how would i do that, without checking if I can get from object (i) to every other object and that for every of my 10thousands of objects? Is there a simpler way?
Many Thanks in advance
Best regards

Réponse acceptée

Sean de Wolski
Sean de Wolski le 22 Juin 2020
I don't completely understand what you mean by linking but it sounds like you want some of the capabilities afforded by digraph. You may want to look into having your objects inherit from a Mixin that can then trace your link tree to create the directed graph.
  1 commentaire
Marc Laub
Marc Laub le 22 Juin 2020
Reading this I somehow wrote my own digraph with nodes, juntion points, edges and polygons which grow and shrink, without knwing there is something impemented already.
by linking I mean that each object has a property called "neighbour_..." in which the objects it is linked to are listed and I need that linking in such a way that it doesnt result in 2 or more subsystems which objects arent linked among each other.
I did it myself now by marking the objects starting from one objects. this objcts marks all its neighbour linked objects which themself mark their neighbours. I stop when there are no more neighbour objects which arent marked already and then check if there are unmarked objects in total. if so I have 2 or more subsystems

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Strategy & Logic dans Help Center et File Exchange

Produits


Version

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by