Computer-Science-A-level-Ocr
-
3-3-networks8 主题
-
3-2-databases7 主题
-
3-1-compression-encryption-and-hashing4 主题
-
2-5-object-oriented-languages7 主题
-
2-4-types-of-programming-language4 主题
-
2-3-software-development5 主题
-
2-2-applications-generation6 主题
-
2-1-systems-software8 主题
-
1-3-input-output-and-storage2 主题
-
1-2-types-of-processor3 主题
-
1-1-structure-and-function-of-the-processor1 主题
-
structuring-your-responses3 主题
-
the-exam-papers2 主题
-
8-2-algorithms-for-the-main-data-structures4 主题
-
8-1-algorithms10 主题
-
7-2-computational-methods11 主题
-
7-1-programming-techniques14 主题
-
capturing-selecting-managing-and-exchanging-data
-
entity-relationship-diagrams
-
data-normalisation
-
relational-databases
-
hashing
-
symmetric-vs-asymmetric-encryption
-
run-length-encoding-and-dictionary-coding
-
lossy-and-lossless-compression
-
polymorphism-oop
-
encapsulation-oop
-
inheritance-oop
-
attributes-oop
-
methods-oop
-
objects-oop
-
capturing-selecting-managing-and-exchanging-data
-
6-5-thinking-concurrently2 主题
-
6-4-thinking-logically2 主题
-
6-3-thinking-procedurally3 主题
-
6-2-thinking-ahead1 主题
-
6-1-thinking-abstractly3 主题
-
5-2-moral-and-ethical-issues9 主题
-
5-1-computing-related-legislation4 主题
-
4-3-boolean-algebra5 主题
-
4-2-data-structures10 主题
-
4-1-data-types9 主题
-
3-4-web-technologies16 主题
-
environmental-effects
-
automated-decision-making
-
computers-in-the-workforce
-
layout-colour-paradigms-and-character-sets
-
piracy-and-offensive-communications
-
analysing-personal-information
-
monitoring-behaviour
-
censorship-and-the-internet
-
artificial-intelligence
-
the-regulation-of-investigatory-powers-act-2000
-
the-copyright-design-and-patents-act-1988
-
the-computer-misuse-act-1990
-
the-data-protection-act-1998
-
adder-circuits
-
flip-flop-circuits
-
simplifying-boolean-algebra
-
environmental-effects
Graphs
What is a Graph?
-
A graph is a set of vertices/nodes that are connected by edges/pointers. Graphs can be placed into the following categories:
-
Directed Graph: The edges can only be traversed in one direction
-
Undirected Graph: The edges can be traversed in both directions
-
Weighted Graph: A value is attached to each edge
Computers are able to process graphs by using either an adjacency matrix or an adjacency list.
The examples below will be illustrated using an adjacency matrix, more information on programming using both matrices and lists is available in section 8.
Undirected, Unweighted Graph
For unweighted graphs:
-
1 is set when an edge exists between 2 nodes
-
0 is set when there is no edge between 2 nodes
Below is the adjacency matrix for an undirected, unweighted graph:

For this graph, the names are abbreviated to the first letter.
-
The data in an adjacency matrix for an unweighted graph is symmetric
-
To determine the presence or absence of an edge, you inspect the row (or column) that represents a node. Example: If you wanted to see if there is an edge between Frogmore and Hartlepool you can look at the cross-section of row 3 (for Frogmore) and column 4 (for Hartlepool)
-
You need a method (e.g Dictionary) to record which row/column is used for a specific node’s edge data
-
The data values for the nodes (in this example names of towns) are not stored in the matrix
Directed, Unweighted Graph

Above is the adjacency matrix for a directed, unweighted graph.
For this graph, the names are abbreviated to the first letter.
-
Due to the lack of symmetry in this matrix, you cannot access the data by both row and column, you must know the direction in which the values are stored
-
E.g.: In row 0 for Bolton there is only one neighbour (Dunkirk) because there is a single directed edge from Bolton towards Dunkirk. This is because there are 3 edges directed towards Bolton (from Dunkirk, Hartlepool and Frogmore)
-
If you are implementing a graph as an adjacency matrix you will need to choose the direction and make sure that the data is stored and accessed correctly
Undirected, Weighted Graph
-
For weighted graphs the values of the weights are stored in the adjacency matrix
-
If an edge does not exist between two nodes, then a very large number (normally the infinity symbol ∞) is set

Above is the adjacency matrix for an undirected, unweighted graph.
For this graph, the names are abbreviated to the first letter.
Directed, Weighted Graph

Above is the adjacency matrix for a directed weighted graph:
For this graph, the names are abbreviated to the first letter.
The Applications of Graphs
Graphs have many uses in the world of Computer Science, for example:
-
Social Networks
-
Transport Networks
-
Operating Systems
|
Keyword |
Definition |
|---|---|
|
Directed Graph |
A directed graph is a set of objects that are connected together, where the edges are directed from one vertex to another. |
|
Undirected Graph |
An undirected graph is a set of objects that are connected together, where the edges do not have a direction. |
|
Weighted Graph |
A weighted graph is a set of objects that are connected together, where a weight is assigned to each edge. |
|
Adjacency Matrix |
Also known as the connection matrix is a matrix containing rows and columns which is used to present a simple labelled graph. |
|
Adjacency List |
This is a collection of unordered lists used to represent a finite graph. |
|
Vertices/Nodes |
A vertex (or node) of a graph is one of the objects that are connected. |
|
Edges/Arcs |
An edge (or arc) is one of the connections between the nodes (or vertices) of the network. |
|
Dictionary |
A collection of names, definitions, and attributes about data elements that are being used or captured in a database, information system, or part of a research project. |
Examiner Tips and Tricks
It is not important what the graph looks like, but which vertices are connected.
Responses