my $graph = Graph->new; $graph->set_vertex_attributes("/", { "type" => "dir" }); my $self = { graph => $graph }; #### sub extract_paths_from_graph { my ($self,$paths_href) = @_; foreach my $vertex ($self->{"graph"}->unique_vertices) { $paths_href->{$vertex}++; } while (1) { my $found_changes = 0; foreach my $vertex ($self->{"graph"}->unique_vertices) { my $type = $self->{"graph"}->get_vertex_attribute($vertex, 'type'); if (index($type,"link") != -1) { # Ignore cycle in graph to prevent infinite loop my $target = ($self->{"graph"}->successors($vertex))[0]; if (path($target)->subsumes($vertex)) { next; } foreach my $subpath (keys(%{$paths_href})) { if ($subpath =~ /^$target\// || $subpath =~ /^$target$/) { my $new_vertex = $subpath =~ s/^$target/$vertex/gr; $found_changes = 1 unless (defined($paths_href->{$new_vertex})); $paths_href->{$new_vertex}++; } } } } last unless ($found_changes); } } #### if ($subpath =~ /^$target\// || $subpath =~ /^$target$/) {