Presentation is loading. Please wait.

Presentation is loading. Please wait.

Class Diagrams Defines Graph Structures 2014

Similar presentations


Presentation on theme: "Class Diagrams Defines Graph Structures 2014"— Presentation transcript:

1 Class Diagrams Defines Graph Structures 2014

2 Association Describes a set of links between objects, indicating some sort of connection between objects of the involved classes. Example: A person may have friends. :friendship p1:Person p2:Person f1 * friendship Person * :friendship :friendship f2 :friendship p3:Person p4:Person :friendship possible graph structure, i.e., objects with links

3 “ordinary graph” with “ordinary names”
f1 * friendship Person * f2 defines an infinite set of graphs where the nodes are called Person and the edges are called friendship end1 edge * * Node end2 “ordinary graph” with “ordinary names” What if we need to attach some information to the edges?

4 Different Types Associations
In UML class diagrams you can distinguish between: Ordinary Association Aggregation(weak aggregation/ Shared Association) Composition (strong aggregation)

5 Aggregation/Composition
Indicates that one object contains objects of a given type, i.e., a whole/part relationship. No cycles are allowed. A transitive relation. the part the whole aggregation using aggregation allows a department to be shared among companies Company Department * 1..* Composition aggregation (strong aggregation) Company Department 1 1..* Must be 1 or 0..1 No limitations on this multiplicity

6 Aggregation is a weaker form of aggregation than composition
Aggregation is a weaker form of aggregation than composition. A part instance might be included in more than one aggregation at a time, which is not allowed for composition. Company Department Employee 1 1..* * 1..* a department can only belong to one company at a time an employee can belong to several departments at a time

7 DirectedAcyclicGraph
Composition defines a directed tree and an aggregation defines a directed graph (without cycles). Using these properties to define a directed graph and directed tree: DirectedAcyclicGraph DirectedTree 0..1 0..1 * 0..1 topRoot * predecessor 1 root Node Node successor  * child * edge edge

8 Do you see errors? DirectedAcyclicGraph Node :Directed- AcyclicGraph
0..1 * * predecessor Node successor  * :Directed- AcyclicGraph edge Do you see errors? :Node :Node :Node :Node :Node :Node :Node :Node

9 Do you see errors? DirectedAcyclicGraph Node :Directed- AcyclickGraph
0..1 * * predecessor Node successor  * :Directed- AcyclickGraph edge Do you see errors? :Node :Node :Node :Node :Node :Node :Node :Node

10 Do you see errors? DirectedTree Node :DirectedTree :Node :Node :Node
0..1 0..1 topRoot 1 root Node child * edge :DirectedTree Do you see errors? :Node :Node :Node :Node :Node :Node :Node :Node

11 Do you see errors? DirectedTree Node :DirectedTree :Node :Node :Node
0..1 0..1 topRoot 1 root Node child * edge :DirectedTree Do you see errors? :Node :Node :Node :Node :Node :Node :Node :Node

12 Deletion Characteristics
UML 2.1 specification: “… If a composite is deleted, all of its parts are normally deleted with it… deleting an element in one part of the graph will also result in the deletion of all elements of the subgraph below that element.”


Download ppt "Class Diagrams Defines Graph Structures 2014"

Similar presentations


Ads by Google