Back to 课程

Computer-science_A-level_Cie

0% Complete
0/0 Steps
  1. computers-and-components
    6 主题
  2. logic-gates-and-logic-circuits
    2 主题
  3. central-processing-unit-cpu-architecture
    6 主题
  4. assembly-language-
    4 主题
  5. bit-manipulation
    1 主题
  6. operating-systems
    3 主题
  7. language-translators
    2 主题
  8. data-security
    3 主题
  9. data-integrity
    1 主题
  10. ethics-and-ownership
    3 主题
  11. database-concepts
    3 主题
  12. database-management-systems-dbms-
    1 主题
  13. data-definition-language-ddl-and-data-manipulation-language-dml
    1 主题
  14. computational-thinking-skills
    1 主题
  15. algorithms
    14 主题
  16. data-types-and-records
    2 主题
  17. arrays
    2 主题
  18. files
    1 主题
  19. introduction-to-abstract-data-types-adt
    1 主题
  20. programming-basics
    1 主题
  21. constructs
    2 主题
  22. structured-programming
    1 主题
  23. program-development-life-cycle
    2 主题
  24. program-design-
    2 主题
  25. program-testing-and-maintenance
    3 主题
  26. user-defined-data-types
    1 主题
  27. file-organisation-and-access-
    3 主题
  28. floating-point-numbers-representation-and-manipulation
    3 主题
  29. protocols
    2 主题
  30. circuit-switching-packet-switching
    1 主题
  31. processors-parallel-processing-and-virtual-machines
    5 主题
  32. boolean-algebra-and-logic-circuits
    4 主题
  33. purposes-of-an-operating-system-os
    3 主题
  34. translation-software
    3 主题
  35. encryption-encryption-protocols-and-digital-certificates
    3 主题
  36. artificial-intelligence-ai
    4 主题
  37. recursion
    1 主题
  38. programming-paradigms
    4 主题
  39. object-oriented-programming
    7 主题
  40. file-processing-and-exception-handling
    2 主题
  41. data-representation
    5 主题
  42. multimedia
    3 主题
  43. compression
    2 主题
  44. networks-and-the-internet
    11 主题
课 Progress
0% Complete

Graphs to aid AI

What is a graph?

  • A graph is a set of vertices/nodes connected by edges/arcs

  • In AI, graphs are used to model relationships, networks, and decision-making problems

  • They can represent things like:

    • Routes between cities (pathfinding)

    • Connections in a neural network

    • State transitions in decision trees or planning

Types of graphs

Type

Use in AI

Directed Graph

Models one-way relationships, such as state transitions in search algorithms (e.g. A*)

Undirected Graph

Useful for bidirectional relationships, such as undirected social connections in a graph

Weighted Graph

Represents costs or heuristics, commonly used in shortest path algorithms like Dijkstra’s or A*

Representation of graphs

  • Graphs can be represented using:

    • Adjacency Matrix – ideal for dense graphs and fast lookup

    • Adjacency List – more space, efficient for sparse graphs (often used in AI search)

  • Both can be used in AI to represent problem spaces such as:

    • Game boards

    • Map-based navigation

    • Resource allocation networks

Undirected, unweighted graph

  • An undirected, unweighted graph is a type of graph where:

    • Edges have no direction , connections go both ways

    • All edges are equal, there are no weights or costs

    • It is represented with a symmetric adjacency matrix, where a 1 indicates a connection and a 0 means no connection

zTX0ndVB_graph
  • In this example:

    • Each node is a town (e.g. Bolton, Dunkirk, Teesside)

    • A 1 in the matrix shows a connection exists between two towns

    • A 0 means no direct connection

  • Example:

    • Bolton and Frogmore have a 1 at their intersection → they are connected

    • Dunkirk and Moulton have a 0 → no direct connection

  • The matrix is symmetric, confirming that the graph is undirected

AI relevance

  • Undirected, unweighted graphs are useful in AI for:

    • Exploring environments, e.g. mapping rooms in a building with equal-cost connections

    • Clustering in machine learning, where the presence of a connection implies similarity

    • Social network analysis, where mutual connections (friendships, links) are undirected

  • These graphs are often used in:

    • Depth-first or breadth-first search

    • Graph traversal algorithms to explore all reachable nodes

Directed, unweighted graph

  • A directed graph (or digraph) is one where edges have a direction

  • This means connections go from one node to another

  • Connections cannot be traversed in reverse unless another directed edge exists

Nw59wh-j_graph-directed-and-unweighted
  • In this example:

    • Each node represents a town

    • Arrows show the direction of travel

    • A 1 in the matrix at (row X, column Y) means there is a directed edge from X to Y

    • A 0 means there is no direct connection

  • For instance:

    • B → D is allowed (matrix value = 1)

    • D → C is not allowed (matrix value = 0)

  • Because this matrix is not symmetric, it reflects the one-way nature of connections

AI relevance

  • Directed, unweighted graphs are essential in AI for:

Use case

How the graph is used

Search algorithms

Used in A*, BFS, DFS where state transitions are directional

Expert systems / rule engines

Representing dependencies between logical conditions or actions

Planning and scheduling

Modelling prerequisites and directed workflows

Navigation

Handling one-way streets or directed transport systems

Undirected, weighted graph

  • An undirected, weighted graph is a graph where:

    • Edges go both ways (no direction)

    • Each edge has a weight, which can represent:

      • Cost

      • Distance

      • Time

      • Risk

  • If no connection exists between two nodes, the matrix contains ∞ (infinity)

P4iS91uk_graph-weighted
  • Nodes represent towns

  • Edges represent roads, and weights represent distances or costs

  • In the matrix:

    • matrix[B][D] = 15 → Bolton to Dunkirk is 15 units

    • matrix[B][C] = ∞ → Bolton and Cardiff are not directly connected

  • The matrix is symmetric, confirming this is an undirected graph

AI relevance

  • Undirected, weighted graphs are widely used in AI when:

Use case

How It helps AI

Pathfinding (e.g. A*, Dijkstra)

Finding the lowest cost path between nodes

Clustering & similarity graphs

Edges represent strength of relationships or similarity weights

Recommendation engines

Connecting users or items based on weighted similarity

Robotics & navigation

Planning efficient movement paths through environments

  • In AI, the weights are crucial for deciding the best route or option when multiple paths are available

Directed, weighted graph

  • A directed, weighted graph is a graph where:

    • Edges have a direction (e.g. A → B but not B → A)

    • Each edge has a weight, such as:

      • Distance

      • Cost

      • Time

      • Probability

  • If there is no edge, the value is ∞ (infinity)

yc9a~wrS_graph-directed-weighted
  • Nodes = Towns

  • Edges = One-way roads

  • Weights = Travel cost or distance

  • The adjacency matrix:

    • B → D = 15 → there is a road from Bolton to Dunkirk costing 15 units

    • C → H = 17 → Cardiff to Hartlepool has a weight of 17

    • H → T = 31 but T → H = ∞ → you can get from Hartlepool to Teesside, but not the other way

  • This matrix is not symmetric, confirming the graph is directed

AI relevance

  • Directed, weighted graphs are critical in AI for:

Use case

Purpose in AI

A and Dijkstra algorithms*

Choosing the shortest path where direction and cost matter

Route planning in robotics

Modelling direction-sensitive travel (e.g. traffic rules)

Search algorithms

Tracking cost between transitions between states

Reinforcement learning

Modelling rewards/costs for state transitions in decision environments

Game AI

Movement systems with terrain costs or restrictions

Responses

您的邮箱地址不会被公开。 必填项已用 * 标注