• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

LearnLib / automatalib / 13138848026

04 Feb 2025 02:53PM UTC coverage: 92.108% (+2.2%) from 89.877%
13138848026

push

github

mtf90
[maven-release-plugin] prepare release automatalib-0.12.0

16609 of 18032 relevant lines covered (92.11%)

1.7 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

83.33
/api/src/main/java/net/automatalib/graph/SimpleGraph.java
1
/* Copyright (C) 2013-2025 TU Dortmund University
2
 * This file is part of AutomataLib <https://automatalib.net>.
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package net.automatalib.graph;
17

18
import java.util.Collection;
19
import java.util.Iterator;
20

21
import net.automatalib.automaton.concept.FiniteRepresentation;
22
import net.automatalib.common.util.mapping.MutableMapping;
23
import net.automatalib.graph.concept.NodeIDs;
24
import net.automatalib.graph.helper.NodeIDGrowingMapping;
25
import net.automatalib.graph.helper.NodeIDStaticMapping;
26
import net.automatalib.graph.helper.SimpleNodeIDs;
27
import net.automatalib.visualization.DefaultVisualizationHelper;
28
import net.automatalib.visualization.VisualizationHelper;
29

30
/**
31
 * The finite version of a {@link IndefiniteSimpleGraph}.
32
 *
33
 * @param <N>
34
 *         node type
35
 */
36
public interface SimpleGraph<N> extends IndefiniteSimpleGraph<N>, FiniteRepresentation {
37

38
    /**
39
     * Retrieves an (unmodifiable) collection of the nodes in this graph.
40
     *
41
     * @return the nodes in this graph
42
     */
43
    Collection<N> getNodes();
44

45
    default NodeIDs<N> nodeIDs() {
46
        return new SimpleNodeIDs<>(this);
1✔
47
    }
48

49
    @Override
50
    default Iterator<N> iterator() {
51
        return getNodes().iterator();
1✔
52
    }
53

54
    /**
55
     * Retrieves the size (number of nodes) of this graph.
56
     *
57
     * @return the number of nodes of this graph
58
     */
59
    @Override
60
    default int size() {
61
        return getNodes().size();
1✔
62
    }
63

64
    @Override
65
    default <V> MutableMapping<N, V> createStaticNodeMapping() {
66
        return new NodeIDStaticMapping<>(nodeIDs(), size());
1✔
67
    }
68

69
    @Override
70
    default <V> MutableMapping<N, V> createDynamicNodeMapping() {
71
        return new NodeIDGrowingMapping<>(nodeIDs(), size());
1✔
72
    }
73

74
    /**
75
     * Returns the {@link VisualizationHelper} that contains information for displaying this graph.
76
     *
77
     * @return the visualization helper
78
     */
79
    default VisualizationHelper<N, ?> getVisualizationHelper() {
80
        return new DefaultVisualizationHelper<>();
×
81
    }
82

83
    /**
84
     * Basic interface for integer abstractions of graphs. In an integer abstraction, each node of a graph is identified
85
     * with an integer in the range {@code [0, size() - 1]}.
86
     */
87
    interface IntAbstraction extends FiniteRepresentation {
88

89
        boolean isConnected(int source, int target);
90
    }
91
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc